/
OldDesign.user.js
35 lines (32 loc) · 957 Bytes
/
OldDesign.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// ==UserScript==
// @name Old Wikipedia Design
// @description Reverts to the old Vector design.
// @author Vusys, chylex
// @version 2
// @license MIT
// @namespace https://chylex.com
// @homepageURL https://github.com/chylex/Userscripts
// @supportURL https://github.com/chylex/Userscripts/issues
// @include https://*.wikipedia.org/*
// @exclude https://*.wikipedia.org/
// @run-at document-start
// @grant none
// ==/UserScript==
(function() {
function fixUrl(href) {
const url = new URL(href);
url.searchParams.set("useskin", "vector");
return url.href;
}
if (!window.location.search.includes("useskin=")) {
location.replace(fixUrl(window.location.href));
return;
}
document.addEventListener("DOMContentLoaded", function() {
for (const a of document.getElementsByTagName("a")) {
if (a.hostname.includes("wikipedia.org")) {
a.href = fixUrl(a.href);
}
}
});
})();