Skip to content

Commit 396ebaf

Browse files
authored
Merge pull request #4 from Xatta-Trone/add-archiev.is
Add archiev.is
2 parents c342d06 + 89c11a0 commit 396ebaf

File tree

4 files changed

+51
-8
lines changed

4 files changed

+51
-8
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,22 @@
2020

2121
### Troubleshooting
2222
* 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.
23-
* This extension does not work when medium redirects to external sites.
23+
* For [archive.is](https://archive.is/), it simply redirects you with the data.
2424

2525
### Credits / Ideas
2626
* [This article on reddit.com](https://www.reddit.com/r/ChatGPT/comments/138jt64/you_can_read_medium_articles_for_free_using_bing/)
2727
## Preview
2828

2929
<p align="center">
30-
<img src="./img/sample.png" />
30+
<img src="./img/sample2.png" />
3131
</p>
3232

3333

3434
### Updates
35+
#### 1.2.0
36+
Added support for [https://archive.is/](https://archive.is/)
37+
#### 1.1.1
38+
Removed dependency on the 3rd party server. Now you can directly read form the Google Web Cache
3539
#### 1.1.0
3640

3741
Added support for all medium.com based websites such as:

app.js

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
11
/** @format */
22
console.log("Medium parser loaded");
33

4+
const ignoreURLs = [
5+
"/me/lists",
6+
"/me/lists/saved",
7+
"/me/list/highlights",
8+
"/me/lists/reading-history",
9+
"/me/stories/public",
10+
"/me/stories/responses",
11+
"/me/stories/drafts",
12+
"/me/stats",
13+
"/me/settings",
14+
"/me/following",
15+
"/me/settings",
16+
"/me/settings/publishing",
17+
"/me/settings/notifications",
18+
"/me/settings/membership",
19+
"/me/settings/security",
20+
"/me/notifications",
21+
"/plans",
22+
"/mastodon",
23+
"/verified-authors",
24+
"/partner-program",
25+
"/gift-plans",
26+
"/new-story",
27+
"/m/signin",
28+
];
29+
430
function init() {
531
if (checkIfGoogleWebCache()) {
6-
formatGoogleWebCache();
32+
return formatGoogleWebCache();
733
}
834

935
checkIfItIsMediumBlog();
@@ -62,25 +88,38 @@ function runMedium(url) {
6288
const root = document.getElementById("root");
6389
root.style.position = "relative";
6490

65-
if (u.pathname.split("/").filter((e) => e).length >= 1) {
91+
if (
92+
ignoreURLs.indexOf(u.pathname) == -1 &&
93+
u.pathname.split("/").filter((e) => e).length >= 1
94+
) {
6695
// get the title
6796

6897
var leftDiv = document.createElement("div"); //Create left div
6998
leftDiv.id = "medium-parser"; //Assign div id
7099
leftDiv.setAttribute(
71100
"style",
72-
"position:absolute;z-index:9999999;top:150px;right:150px;"
101+
"position:absolute;z-index:1;top:150px;right:150px;"
73102
); //Set div attributes
74103
a = document.createElement("a");
75104
a.href = `http://webcache.googleusercontent.com/search?q=cache:${url}&strip=0&vwsrc=1&referer=medium-parser`; // Instead of calling setAttribute
76-
a.innerHTML = "Read full article"; // <a>INNER_TEXT</a>
105+
a.innerHTML = "Read from Google Cache";
77106
a.setAttribute(
78107
"style",
79-
"padding:10px 25px; color:white; background: #2c3e50; display:block;"
108+
"padding:14px 25px; color:white; background: #242424; display:block;text-align:center;"
80109
); //Set div attributes
81110
a.setAttribute("target", "_blank"); //Set div attributes
82111

112+
archive = document.createElement("a");
113+
archive.href = `https://archive.is?url=${url}&run=1&referer=medium-parser`; // Instead of calling setAttribute
114+
archive.innerHTML = "Read from Archive.is";
115+
archive.setAttribute(
116+
"style",
117+
"padding:14px 25px; color:white; background: #242424; display:block; margin-top:10px;text-align:center;"
118+
); //Set div attributes
119+
archive.setAttribute("target", "_blank"); //Set div attributes
120+
83121
leftDiv.appendChild(a); // Append the link to the div
122+
leftDiv.appendChild(archive);
84123
root.appendChild(leftDiv); // A
85124
} else {
86125
// remove the element

img/sample2.png

1.45 MB
Loading

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "Medium parser",
4-
"version": "1.1.1",
4+
"version": "1.2.0",
55
"description": "Unlocks the whole medium article on the go.",
66
"icons": {
77
"16": "img/icon16.png",

0 commit comments

Comments
 (0)