add js userscript

This commit is contained in:
Aravinth Manivannan 2021-10-31 23:06:16 +05:30
parent d02d4d2e49
commit bc45c6f5dd
Signed by untrusted user: realaravinth
GPG key ID: AD9F0F08E855ED88

32
libmedium.user.js Normal file
View 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;
}
});
}
}
})();