summaryrefslogtreecommitdiffstats
path: root/.config/qutebrowser/greasemonkey/old-wiki.js
blob: d14775b1deaf1a72e65dd435cf1f7e9fb62bce05 (plain) (blame)
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
// ==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);
})();
remember that computers suck.