Redirects Wikipedia to use the good (pre-2023) skin.
当前为
// ==UserScript==
// @name Old Wikipedia Layout
// @namespace http://greasyfork.org/
// @version 0.0
// @description Redirects Wikipedia to use the good (pre-2023) skin.
// @author Sheer Anger
// @match *://*.wikipedia.org/*
// @icon https://www.google.com/s2/favicons?domain=www.wikipedia.org
// @grant none
// @license MIT
// ==/UserScript==
/*(function() {
if (!window.location.href.includes("useskin")){
if (window.location.href.includes("?")){
window.location.replace(window.location.href.concat("&useskin=vector"));
}
else {
window.location.replace(window.location.href.concat("?useskin=vector"));
}
}
return false;
})();*/
function test(url){
return !!url.match(/(?!.*useskin)^(|http(s?):\/\/)(|www\.|\w{2,6}\.)(|m\.)wikipedia.org(\/.*|$)/gim);
}
function getNewPage(url){
var que = '?';
if(url.includes("?")){que = '&'};
return url.concat(que,"useskin=vector");
}
function fixWikiLinks(){
var links = Array.prototype.slice.call(document.links, 0);
links.filter(function(link){
if(test(link.href)){
var greatNewLink = getNewPage(link.href);
if(link.hasAttribute('data-outbound-url')) link.setAttribute('data-outbound-url', greatNewLink);
link.setAttribute('href', greatNewLink);
}
});
}
if(test(window.location.href)){window.location.assign(getNewPage(window.location.href));}
window.onload = fixWikiLinks;
setInterval(fixWikiLinks, 50);