33 lines
897 B
JavaScript
33 lines
897 B
JavaScript
// ==UserScript==
|
|
// @name LibMedium proxy
|
|
// @version 0.1.0
|
|
// @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;
|
|
let lib = new URL(libmediumHost);
|
|
for (let i = 0; i < urls.length; i++) {
|
|
blacklist.forEach((url) => {
|
|
if (urls[i].host.includes(url)) {
|
|
urls[i].host = lib.host;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
})();
|
|
|