-
Notifications
You must be signed in to change notification settings - Fork 2
/
liberá-the-wiki.user.js
53 lines (45 loc) · 1.61 KB
/
liberá-the-wiki.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// ==UserScript==
// @name Liberá my Wiki
// @namespace Violentmonkey Scripts
// @match *://banjokazooie.fandom.com/*
// @match *://half-life.fandom.com/*
// @grant none
// @version 1.0
// @author LongJohn-Silver
// @description Converts Fandom Wiki links to MediaWiki links
// ==/UserScript==
function test(url){
return !!url.match(/^(|http(s?):\/\/)(|www.)banjokazooie.fandom.com(\/.*|$)/gim);
}
function getNewPagePlease(url){
return 'https://banjokazooiewiki.com/';
}
function fixWikiStuff(){
var links = Array.prototype.slice.call(document.links, 0);
links.filter(function(link){
if(test(link.href)){
var greatNewLink = getNewPagePlease(link.href);
if(link.hasAttribute('data-outbound-url')) link.setAttribute('data-outbound-url', greatNewLink);
link.setAttribute('href', greatNewLink);
}
});
}
function test(url){
return !!url.match(/^(|http(s?):\/\/)(|www.)half-life.fandom.com(\/.*|$)/gim);
}
function getNewPagePlease(url){
return 'https://combineoverwiki.net/';
}
function fixWikiStuff(){
var links = Array.prototype.slice.call(document.links, 0);
links.filter(function(link){
if(test(link.href)){
var greatNewLink = getNewPagePlease(link.href);
if(link.hasAttribute('data-outbound-url')) link.setAttribute('data-outbound-url', greatNewLink);
link.setAttribute('href', greatNewLink);
}
});
}
if(test(window.location.href)){window.location.assign(getNewPagePlease(window.location.href));}
window.onload = fixWikiStuff;
setInterval(fixWikiStuff, 50);