forked from realaravinth/libmedium
fix js userscript
This commit is contained in:
parent
bc45c6f5dd
commit
6ea970e7a6
1 changed files with 4 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name LibMedium proxy
|
// @name LibMedium proxy
|
||||||
// @version 0.1.1
|
// @version 0.1.0
|
||||||
// @description Re-writes medium.com URLs in point to libmedium
|
// @description Re-writes medium.com URLs in point to libmedium
|
||||||
// @author Aravinth Manivannan
|
// @author Aravinth Manivannan
|
||||||
// @match https://*/*
|
// @match https://*/*
|
||||||
|
@ -20,13 +20,14 @@ const libmediumHost = "https://libmedium.batsense.net";
|
||||||
// morty has a button to go to the original site, re-writing that would be stupid
|
// morty has a button to go to the original site, re-writing that would be stupid
|
||||||
if (!window.location.href.includes(libmediumHost)) {
|
if (!window.location.href.includes(libmediumHost)) {
|
||||||
let urls = document.links;
|
let urls = document.links;
|
||||||
|
let lib = new URL(libmediumHost);
|
||||||
for (let i = 0; i < urls.length; i++) {
|
for (let i = 0; i < urls.length; i++) {
|
||||||
blacklist.forEach((url) => {
|
blacklist.forEach((url) => {
|
||||||
if (urls[i].host.includes(url)) {
|
if (urls[i].host.includes(url)) {
|
||||||
urls[i].host = libmediumHost;
|
urls[i].host = lib.host;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue