From 2b6bad9b2ba7a25c99e5f5b705de61e3661e89ef Mon Sep 17 00:00:00 2001 From: chylex <contact@chylex.com> Date: Mon, 23 Jan 2023 10:37:16 +0100 Subject: [PATCH] Add 'Old Wikipedia Design' --- Wikipedia/OldDesign.user.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Wikipedia/OldDesign.user.js diff --git a/Wikipedia/OldDesign.user.js b/Wikipedia/OldDesign.user.js new file mode 100644 index 0000000..042fcaa --- /dev/null +++ b/Wikipedia/OldDesign.user.js @@ -0,0 +1,33 @@ +// ==UserScript== +// @name Old Wikipedia Design +// @description Reverts to the old Vector design. +// @author Vusys, chylex +// @version 1 +// @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-end +// @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; + } + + for (const a of document.getElementsByTagName("a")) { + if (a.hostname.includes("wikipedia.org")) { + a.href = fixUrl(a.href); + } + } +})();