-
Notifications
You must be signed in to change notification settings - Fork 0
/
rule34xxx-ad-block.user.js
84 lines (72 loc) · 2.96 KB
/
rule34xxx-ad-block.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// ==UserScript==
// @name booru block bottom exoclick ads
// @namespace dragontamer8740.fuckExoclick
// @description Block ads below paginator on r34.xxx (eventually other boorus too)
// @version 1
// @include https://rule34.xxx/*
// @match https://rule34.xxx/*
// @include http://rule34.xxx/*
// @match http://rule34.xxx/*
// @include http://hypnohub.net/*
// @match http://hypnohub.net/*
// @include https://hypnohub.net/*
// @match https://hypnohub.net/*
// @run-at document-start
// @grant none
// ==/UserScript==
/* this is a pretty weird one as far as blocking scripts go. */
/* it seems that exoclick ads are being fed through some javascript which attempts to defeat
blockers with inline JS loading stubs which only activate after the page has been loaded,
after when adblockers seem to apply their blocks.
This code should (if I myself remember what I did correctly months later) run before any
inline javascript. The code itself checks the contents of said scripts with simple
heuristic methods that prevent certain naughty/unwanted bahaviour from taking place.
The rationale behind the chosen heuristics is that there is absolutely no good reason
that any non-advertisement script on these pages would need to use the code segments
i picked. Thus the only remaining purposes are subversive or advertising, both of which
I disapprove of. */
window.addEventListener('beforescriptexecute', function(e){
if(e.target.innerHTML.includes("addEventListener") && e.target.innerHTML.includes("appendChild"))
{
// we've got a self modifying webpage of cancer.
// EXTERMINATE with webpage modifying code :D
e.target.innerHTML="";
// remove our listener to make the page work better now
window.removeEventListener(e.type, arguments.callee, true);
}
}, true);
/* https://rule34.xxx/images/hi_ublock_lets_play */
window.addEventListener('load', function() {
var adscancer=document.querySelectorAll("a[target='_blank']");
var i=1;
while(i<adscancer.length){
adscancer[i].innerHTML="";
i++;
}
}, false);
window.addEventListener('load', function() {
var adscancer=document.querySelectorAll("a[href^='https://rule34.xxx/page/out?s=']");
var i=0;
while(i<adscancer.length){
adscancer[i].innerHTML="";
i++;
}
}, false);
/* hypnohub uses more tricks */
window.addEventListener('beforescriptexecute', function(e){
if(e.target.innerHTML.includes("observe(\"dom:loaded\""))
{
// remove the entire script from the page so that nothing gets executed
e.target.innerHTML="";
// remove our listener to make the page work better now
window.removeEventListener(e.type, arguments.callee, true);
}
}, true);
/* might not work at document-start */
var adscancer=document.querySelectorAll("a[target='_blank']");
var i=1;
while(i<adscancer.length){
adscancer[i].innerHTML="";
adscancer[i].style.display="none";
i++;
}