-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
38 lines (36 loc) · 1.42 KB
/
script.js
File metadata and controls
38 lines (36 loc) · 1.42 KB
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
36
37
38
// ==UserScript==
// @name Anti French Layout
// @namespace http://tampermonkey.net/
// @version 0.3.2
// @description Anti-French-English
// @author Me
// @match *://*/*
// @icon none
// @grant none
// ==/UserScript==
let blocklist = ['fr.wikipedia.org', 'ja.wikipedia.org', 'en.wikipedia.org', 'es.wikipedia.org', 'nl.wikipedia.org', 'da.wikipedia.org', 'wiki.archlinux.org']; //add ur own here if u see one not using standart
(function () {
'use strict';
function w(a) {
for (let i of blocklist) {
if (a.startsWith(`https:\/\/${i}\/`) && !a.includes('useskin=vector')) {
let b = a.includes('#') ? a.substring(a.indexOf('#'), a.length) : '';
a = a.replace(b, '');
a.includes('?') ? a += '&useskin=vector' : a += '?useskin=vector';
a += b;
}
}
return a;
}
//add to url to use normal layout
let a = w(window.location.href);
window.location.href != a ? window.location.href = a : null;
//add to all urls on site to not load the clicked page twice (bc browser will reload when editing the url)
var s = document.evaluate("//a[@href]", document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < s.snapshotLength; i++) {
var l = s.snapshotItem(i);
a = w(l.href);
l.href != a ? l.href = a : null;
}
})();