diff --git a/README.md b/README.md index c554add..76c6304 100644 --- a/README.md +++ b/README.md @@ -20,18 +20,22 @@ ### Troubleshooting * This extension pulls the data from `webcache.googleusercontent.com`; then removes all the scripts and sends back the html and css contents only. It might not work when there is no data from the request. -* This extension does not work when medium redirects to external sites. +* For [archive.is](https://archive.is/), it simply redirects you with the data. ### Credits / Ideas * [This article on reddit.com](https://www.reddit.com/r/ChatGPT/comments/138jt64/you_can_read_medium_articles_for_free_using_bing/) ## Preview

- +

### Updates +#### 1.2.0 +Added support for [https://archive.is/](https://archive.is/) +#### 1.1.1 +Removed dependency on the 3rd party server. Now you can directly read form the Google Web Cache #### 1.1.0 Added support for all medium.com based websites such as: diff --git a/app.js b/app.js index bbcbc4a..4677733 100644 --- a/app.js +++ b/app.js @@ -1,9 +1,35 @@ /** @format */ console.log("Medium parser loaded"); +const ignoreURLs = [ + "/me/lists", + "/me/lists/saved", + "/me/list/highlights", + "/me/lists/reading-history", + "/me/stories/public", + "/me/stories/responses", + "/me/stories/drafts", + "/me/stats", + "/me/settings", + "/me/following", + "/me/settings", + "/me/settings/publishing", + "/me/settings/notifications", + "/me/settings/membership", + "/me/settings/security", + "/me/notifications", + "/plans", + "/mastodon", + "/verified-authors", + "/partner-program", + "/gift-plans", + "/new-story", + "/m/signin", +]; + function init() { if (checkIfGoogleWebCache()) { - formatGoogleWebCache(); + return formatGoogleWebCache(); } checkIfItIsMediumBlog(); @@ -62,25 +88,38 @@ function runMedium(url) { const root = document.getElementById("root"); root.style.position = "relative"; - if (u.pathname.split("/").filter((e) => e).length >= 1) { + if ( + ignoreURLs.indexOf(u.pathname) == -1 && + u.pathname.split("/").filter((e) => e).length >= 1 + ) { // get the title var leftDiv = document.createElement("div"); //Create left div leftDiv.id = "medium-parser"; //Assign div id leftDiv.setAttribute( "style", - "position:absolute;z-index:9999999;top:150px;right:150px;" + "position:absolute;z-index:1;top:150px;right:150px;" ); //Set div attributes a = document.createElement("a"); a.href = `http://webcache.googleusercontent.com/search?q=cache:${url}&strip=0&vwsrc=1&referer=medium-parser`; // Instead of calling setAttribute - a.innerHTML = "Read full article"; // INNER_TEXT + a.innerHTML = "Read from Google Cache"; a.setAttribute( "style", - "padding:10px 25px; color:white; background: #2c3e50; display:block;" + "padding:14px 25px; color:white; background: #242424; display:block;text-align:center;" ); //Set div attributes a.setAttribute("target", "_blank"); //Set div attributes + archive = document.createElement("a"); + archive.href = `https://archive.is?url=${url}&run=1&referer=medium-parser`; // Instead of calling setAttribute + archive.innerHTML = "Read from Archive.is"; + archive.setAttribute( + "style", + "padding:14px 25px; color:white; background: #242424; display:block; margin-top:10px;text-align:center;" + ); //Set div attributes + archive.setAttribute("target", "_blank"); //Set div attributes + leftDiv.appendChild(a); // Append the link to the div + leftDiv.appendChild(archive); root.appendChild(leftDiv); // A } else { // remove the element diff --git a/img/sample2.png b/img/sample2.png new file mode 100644 index 0000000..345531d Binary files /dev/null and b/img/sample2.png differ diff --git a/manifest.json b/manifest.json index 16970f1..f8042df 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Medium parser", - "version": "1.1.1", + "version": "1.2.0", "description": "Unlocks the whole medium article on the go.", "icons": { "16": "img/icon16.png",