NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name slimgur redirect // @namespace https://voat.co/ // @description Redirect slimgur.com and slimgr.com links to sli.mg // @author kashka (https://voat.co/u/kashka) // @include https://voat.co/* // @include https://www.voat.co/* // @version 0.3 // @grant none // @run-at document-start // @downloadURL https://openuserjs.org/install/kashka/slimgur_redirect.user.js // ==/UserScript== function redirectLinks() { var i, links = document.getElementsByTagName("a"); for(i = 0; i < links.length; i++) { if(links[i].getAttribute("href")) { links[i].setAttribute("href", links[i].getAttribute("href").replace(/https?:\/\/(?:www\.)?slimgu?r\.com\/(.+)/, "https://sli.mg/$1")); } } var custom_css = document.getElementsByTagName("style"); for(i = 0; i < custom_css.length; i++) { if(custom_css[i].id && custom_css[i].id == "custom_css") { var text = custom_css[i].textContent || custom_css[i].innerText; text = text.replace(/https?:\/\/(?:www\.)?slimgu?r\.com\/([a-z0-9/.]+)/ig, "https://sli.mg/$1"); while(custom_css[i].firstChild) custom_css[i].removeChild(custom_css[i].firstChild); custom_css[i].appendChild(document.createTextNode(text)); } } } document.addEventListener("DOMContentLoaded", redirectLinks, false);