-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredirect-free.js
67 lines (59 loc) · 2.11 KB
/
redirect-free.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//# replaces redirect link to original. Simple antitracking
!(function(global) {
var waitCommon = function(fn) {
if(global.Bga) {
fn()
}
else {
setTimeout(function() {
waitCommon(fn)
}, 0)
}
}
var redirects = [
[/^(?:https?:\/\/)?(?:www\.)?google\.(?:com|ru|co\.uk)\/url\?([\s\S]*)$/, function(match) {
var qso = Bga.parseQueryString(match[1])
return qso["url"] || qso["q"];
}],
//# { "https://www.youtube.com/redirect?q=https%3A%2F%2Fwww.controllino.biz%2F&redir_token=FjbYZ_bLMLiFByycIw2lQE8QbDd8MTU2Mzg4MDQ4MUAxNTYzNzk0MDgx&event=video_description&v=0fDPBtbsUgc" }
[/^(?:https?:\/\/)?(?:www\.)?youtube\.(?:com)\/redirect\?([\s\S]*)$/, function(match) {
var qso = Bga.parseQueryString(match[1])
return qso["url"] || qso["q"];
}],
//# { "https://m.vk.com/away.php?to=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DKbQFboIEMcI&post=6666666_66" }
[/^(?:https?:\/\/)?(?:www\.)?(?:m\.)?vk\.(?:com)\/away.php\?([\s\S]*)$/, function(match) {
var qso = parseQueryString(match[1])
return qso["to"];
}],
[/^(?:http:\/\/)?forum\.funkysouls\.com\/go\.php\?([^&]*)/, function(match) {
return decodeURIComponent(match[1]);
}]
]
waitCommon(function() {
with(Bga) {
onDOMReady(function() {
var log = 1 ? logRaw : logNull
var as = document.links || []
var a, i = -1
while((a = as[++i]) != null) {
var href = a.getAttribute('href')
if(href.match(/^http(s?)/) == null) {
href = "".concat(location.protocol, "//", location.host, href)
}
else {
}
0 && log("url", href)
var j = -1, r = null; while((r = redirects[++j]) != null) {
var match = r[0].exec(href)
if(match != null) {
log("match", match)
a.setAttribute('href', r[1](match))
}
else {
}
}
}
})
}
})
})(this)