libmedium/libmedium.user.js

34 lines
897 B
JavaScript
Raw Normal View History

2021-10-31 23:06:16 +05:30
// ==UserScript==
// @name LibMedium proxy
2021-10-31 23:11:12 +05:30
// @version 0.1.0
2021-10-31 23:06:16 +05:30
// @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;
2021-10-31 23:11:12 +05:30
let lib = new URL(libmediumHost);
2021-10-31 23:06:16 +05:30
for (let i = 0; i < urls.length; i++) {
blacklist.forEach((url) => {
if (urls[i].host.includes(url)) {
2021-10-31 23:11:12 +05:30
urls[i].host = lib.host;
2021-10-31 23:06:16 +05:30
}
});
}
}
})();
2021-10-31 23:11:12 +05:30