15 baitClass:
'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links',
16 baitStyle:
'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;',
25 event: { detected: [], notDetected: [] }
31 var eventCallback =
function() {
32 setTimeout(
function() {
33 if(
self.
_options.checkOnLoad ===
true) {
34 if(self._options.debug === true) {
35 self._log(
'onload->eventCallback',
'A check loading is launched');
37 if(
self._var.bait ===
null) {
40 setTimeout(
function() {
47 window.addEventListener(
'load', eventCallback,
false);
49 window.attachEvent(
'onload', eventCallback);
57 console.log(
'[FuckAdBlock]['+method+
'] '+message);
66 for(var option in options) {
67 this.
_options[option] = options[option];
69 this.
_log(
'setOption',
'The option "'+option+
'" he was assigned to "'+options[option]+
'"');
76 var bait = document.createElement(
'div');
77 bait.setAttribute(
'class', this.
_options.baitClass);
78 bait.setAttribute(
'style', this.
_options.baitStyle);
79 this.
_var.bait =
window.document.body.appendChild(bait);
81 this.
_var.bait.offsetParent;
82 this.
_var.bait.offsetHeight;
83 this.
_var.bait.offsetLeft;
84 this.
_var.bait.offsetTop;
85 this.
_var.bait.offsetWidth;
86 this.
_var.bait.clientHeight;
87 this.
_var.bait.clientWidth;
90 this.
_log(
'_creatBait',
'Bait has been created');
94 window.document.body.removeChild(this.
_var.bait);
95 this.
_var.bait =
null;
98 this.
_log(
'_destroyBait',
'Bait has been removed');
108 this.
_log(
'check',
'An audit was requested '+(loop===
true?
'with a':
'without')+
' loop');
111 if(this.
_var.checking ===
true) {
113 this.
_log(
'check',
'A check was canceled because there is already an ongoing');
117 this.
_var.checking =
true;
119 if(this.
_var.bait ===
null) {
124 this.
_var.loopNumber = 0;
126 this.
_var.loop = setInterval(
function() {
127 self._checkBait(loop);
130 setTimeout(
function() {
131 self._checkBait(loop);
134 this.
_log(
'check',
'A check is in progress ...');
140 var detected =
false;
142 if(this.
_var.bait ===
null) {
146 if(
window.document.body.getAttribute(
'abp') !==
null
147 ||
this._var.bait.offsetParent ===
null
148 ||
this._var.bait.offsetHeight == 0
149 ||
this._var.bait.offsetLeft == 0
150 ||
this._var.bait.offsetTop == 0
151 ||
this._var.bait.offsetWidth == 0
152 ||
this._var.bait.clientHeight == 0
153 ||
this._var.bait.clientWidth == 0) {
157 var baitTemp =
window.getComputedStyle(this.
_var.bait,
null);
158 if(baitTemp && (baitTemp.getPropertyValue(
'display') ==
'none' || baitTemp.getPropertyValue(
'visibility') ==
'hidden')) {
164 this.
_log(
'_checkBait',
'A check ('+(this.
_var.loopNumber+1)+
'/'+
this._options.loopMaxNumber+
' ~'+(1+
this._var.loopNumber*
this._options.loopCheckTime)+
'ms) was conducted and detection is '+(detected===
true?
'positive':
'negative'));
168 this.
_var.loopNumber++;
169 if(this.
_var.loopNumber >=
this._options.loopMaxNumber) {
174 if(detected ===
true) {
179 this.
_var.checking =
false;
181 }
else if(this.
_var.loop ===
null || loop ===
false) {
185 this.
_var.checking =
false;
190 clearInterval(this.
_var.loop);
191 this.
_var.loop =
null;
192 this.
_var.loopNumber = 0;
195 this.
_log(
'_stopLoop',
'A loop has been stopped');
201 this.
_log(
'emitEvent',
'An event with a '+(detected===
true?
'positive':
'negative')+
' detection was called');
204 var fns = this.
_var.event[(detected===
true?
'detected':
'notDetected')];
207 this.
_log(
'emitEvent',
'Call function '+(parseInt(
i)+1)+
'/'+fns.length);
209 if(fns.hasOwnProperty(
i)) {
213 if(this.
_options.resetOnEnd ===
true) {
219 this.
_var.event.detected = [];
220 this.
_var.event.notDetected = [];
223 this.
_log(
'clearEvent',
'The event list has been cleared');
228 this.
_var.event[(detected===
true?
'detected':
'notDetected')].push(fn);
230 this.
_log(
'on',
'A type of event "'+(detected===
true?
'detected':
'notDetected')+
'" was added');
236 return this.
on(
true, fn);
239 return this.
on(
false, fn);
FuckAdBlock prototype _var
FuckAdBlock prototype emitEvent
FuckAdBlock prototype clearEvent
FuckAdBlock prototype _log
FuckAdBlock prototype _options
FuckAdBlock prototype setOption
FuckAdBlock prototype _creatBait
FuckAdBlock prototype _stopLoop
FuckAdBlock prototype _destroyBait