This repository has been archived by the owner on Mar 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
/
FuckFuckAdBlock.user.js
105 lines (88 loc) · 3.11 KB
/
FuckFuckAdBlock.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// ==UserScript==
// @name Fuck FuckAdBlock
// @author Mechazawa
// @namespace Mechazawa
// @description Acts like FuckAdBlock.js but always says that no adblock was detected.
// @license WTFPl
// @version 7
// @include *
// @run-at document-start
// @updateURL https://raw.githubusercontent.com/Mechazawa/FuckFuckAdblock/master/FuckFuckAdBlock.user.js
// @grant none
// ==/UserScript==
(function(window) {
var debug = false;
var FuckAdBlock = function(options) {
if(options !== undefined)
this.setOption(options);
var self = this;
window.addEventListener('load', function() {
setTimeout(function() {
if(self._options.checkOnLoad === true)
self.check(false);
}, 1);
}, false);
// hotfix
this.debug = {
set: function(x){ debug = !!x; return self;},
get: function(){ return debug; }
};
};
FuckAdBlock.prototype = {
setOption : function(options, value) {
if(value !== undefined) {
var key = options;
options = {};
options[key] = value;
}
for(var option in options)
this._options[option] = options[option];
return this;
},
_options : {
checkOnLoad: true,
resetOnEnd: true,
},
_var : {
triggers: []
},
check : function(ignore) {
this.emitEvent(false);
return true;
},
clearEvent : function() {
this._var.triggers = [];
},
emitEvent : function(detected) {
if(detected === false) {
var fns = this._var.triggers;
for (var i = 0; i < fns.length; i += 1) {
if (fns[i] instanceof Function) { fns[i](); }
}
if(this._options.resetOnEnd === true)
this.clearEvent();
}
return this;
},
on : function(detected, fn) {
if(detected === false)
this._var.triggers.push(fn);
return this;
},
onDetected : function(fn) {
return this;
},
onNotDetected : function(fn) {
return this.on(false, fn);
}
};
var fuck = new FuckAdBlock();
for (var field in fuck) {
Object.defineProperty(fuck, field, {value: fuck[field], configurable: false});
}
Object.defineProperties(window, {fuckAdBlock : { value: fuck, enumerable: true, writable: false }});
Object.defineProperties(window, {blockAdBlock : { value: fuck, enumerable: true, writable: false }});
Object.defineProperties(window, {sniffAdBlock : { value: fuck, enumerable: true, writable: false }});
Object.defineProperties(window, {duckAdBlock : { value: fuck, enumerable: true, writable: false }});
Object.defineProperties(window, {FuckFuckFuckAdBlock : { value: fuck, enumerable: true, writable: false }});
})(window);