Skip to content

Commit

Permalink
Merge pull request #4 from Xatta-Trone/add-archiev.is
Browse files Browse the repository at this point in the history
Add archiev.is
  • Loading branch information
Xatta-Trone authored Sep 26, 2023
2 parents c342d06 + 89c11a0 commit 396ebaf
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<p align="center">
<img src="./img/sample.png" />
<img src="./img/sample2.png" />
</p>


### 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:
Expand Down
49 changes: 44 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
@@ -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();
Expand Down Expand Up @@ -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"; // <a>INNER_TEXT</a>
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
Expand Down
Binary file added img/sample2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 396ebaf

Please sign in to comment.