add js userscript
This commit is contained in:
parent
d02d4d2e49
commit
bc45c6f5dd
1 changed files with 32 additions and 0 deletions
32
libmedium.user.js
Normal file
32
libmedium.user.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
// ==UserScript==
|
||||
// @name LibMedium proxy
|
||||
// @version 0.1.1
|
||||
// @description Re-writes medium.com URLs in point to libmedium
|
||||
// @author Aravinth Manivannan
|
||||
// @match https://*/*
|
||||
// @match http://*/*
|
||||
// @grant AGPLv3 or above
|
||||
// ==/UserScript==
|
||||
|
||||
// websites to be proxied
|
||||
const blacklist = ["medium.com", "blog.discord.com", "uxdesign.cc"];
|
||||
|
||||
// Location of the proxy
|
||||
const libmediumHost = "https://libmedium.batsense.net";
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// morty has a button to go to the original site, re-writing that would be stupid
|
||||
if (!window.location.href.includes(libmediumHost)) {
|
||||
let urls = document.links;
|
||||
|
||||
for (let i = 0; i < urls.length; i++) {
|
||||
blacklist.forEach((url) => {
|
||||
if (urls[i].host.includes(url)) {
|
||||
urls[i].host = libmediumHost;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
Loading…
Reference in a new issue