diff options
Diffstat (limited to '.config/qutebrowser/greasemonkey/old-wiki.js')
-rwxr-xr-x | .config/qutebrowser/greasemonkey/old-wiki.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/.config/qutebrowser/greasemonkey/old-wiki.js b/.config/qutebrowser/greasemonkey/old-wiki.js new file mode 100755 index 0000000..d14775b --- /dev/null +++ b/.config/qutebrowser/greasemonkey/old-wiki.js @@ -0,0 +1,30 @@ +// ==UserScript== +// @name old wiki vector style +// @match *://*.wikipedia.org/* +// @match *://*.wiki.archlinux.org/* +// @grant none +// ==/UserScript== + +(function() { + const url = new URL(window.location.href); + + if(url.toString().indexOf('useskin') === -1){ + url.searchParams.set('useskin', 'vector'); + location.replace(url); + } + + const a = document.getElementsByTagName('a'); + + for (var i = 0; i < a.length; ++i){ + if(a[i].href.indexOf(window.location.host) === -1){ + continue; + } + + let href = new URL(a[i].href); + href.searchParams.set('useskin', 'vector'); + a[i].href = href; + } + + url.searchParams.delete('useskin'); + history.replaceState(null, document.title, url.href); +})(); |