PageSourceSearch

https://windowsxlive.net/wp-content/plugins/wp-adblock-dedect/js/d…?ver=61da7684692bb8e34c546aef2c86bd52

js windowsxlive.net collected 2026-10-02 14:55:53 UTC 6,912 bytes, 251 lines download raw bytes

vendor: 6,912 bytes, lines 1-251
1/*
2 * FuckAdBlock 3.2.0
3 * Copyright (c) 2015 Valentin Allaire <[email protected]>
4 * Released under the MIT license
5 * https://github.com/sitexw/FuckAdBlock
6 */
7
8(function(window) {
9	var FuckAdBlock = function(options) {
10		this._options = {
11			checkOnLoad:		false,
12			resetOnEnd:			false,
13			loopCheckTime:		50,
14			loopMaxNumber:		5,
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;',
17			debug:				false
18		};
19		this._var = {
20			version:			'3.2.0',
21			bait:				null,
22			checking:			false,
23			loop:				null,
24			loopNumber:			0,
25			event:				{ detected: [], notDetected: [] }
26		};
27		if(options !== undefined) {
28			this.setOption(options);
29		}
30		var self = this;
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');
36					}
37					if(self._var.bait === null) {
38						self._creatBait();
39					}
40					setTimeout(function() {
41						self.check();
42					}, 1);
43				}
44			}, 1);
45		};
46		if(window.addEventListener !== undefined) {
47			window.addEventListener('load', eventCallback, false);
48		} else {
49			window.attachEvent('onload', eventCallback);
50		}
51	};
52	FuckAdBlock.prototype._options = null;
53	FuckAdBlock.prototype._var = null;
54	FuckAdBlock.prototype._bait = null;
55	
56	FuckAdBlock.prototype._log = function(method, message) {
57		console.log('[FuckAdBlock]['+method+'] '+message);
58	};
59	
60	FuckAdBlock.prototype.setOption = function(options, value) {
61		if(value !== undefined) {
62			var key = options;
63			options = {};
64			options[key] = value;
65		}
66		for(var option in options) {
67			this._options[option] = options[option];
68			if(this._options.debug === true) {
69				this._log('setOption', 'The option "'+option+'" he was assigned to "'+options[option]+'"');
70			}
71		}
72		return this;
73	};
74	
75	FuckAdBlock.prototype._creatBait = function() {
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);
80		
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;
88		
89		if(this._options.debug === true) {
90			this._log('_creatBait', 'Bait has been created');
91		}
92	};
93	FuckAdBlock.prototype._destroyBait = function() {
94		window.document.body.removeChild(this._var.bait);
95		this._var.bait = null;
96		
97		if(this._options.debug === true) {
98			this._log('_destroyBait', 'Bait has been removed');
99		}
100	};
101	
102	FuckAdBlock.prototype.check = function(loop) {
103		if(loop === undefined) {
104			loop = true;
105		}
106		
107		if(this._options.debug === true) {
108			this._log('check', 'An audit was requested '+(loop===true?'with a':'without')+' loop');
109		}
110		
111		if(this._var.checking === true) {
112			if(this._options.debug === true) {
113				this._log('check', 'A check was canceled because there is already an ongoing');
114			}
115			return false;
116		}
117		this._var.checking = true;
118		
119		if(this._var.bait === null) {
120			this._creatBait();
121		}
122		
123		var self = this;
124		this._var.loopNumber = 0;
125		if(loop === true) {
126			this._var.loop = setInterval(function() {
127				self._checkBait(loop);
128			}, this._options.loopCheckTime);
129		}
130		setTimeout(function() {
131			self._checkBait(loop);
132		}, 1);
133		if(this._options.debug === true) {
134			this._log('check', 'A check is in progress ...');
135		}
136		
137		return true;
138	};
139	FuckAdBlock.prototype._checkBait = function(loop) {
140		var detected = false;
141		
142		if(this._var.bait === null) {
143			this._creatBait();
144		}
145		
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) {
154			detected = true;
155		}
156		if(window.getComputedStyle !== undefined) {
157			var baitTemp = window.getComputedStyle(this._var.bait, null);
158			if(baitTemp.getPropertyValue('display') == 'none'
159			|| baitTemp.getPropertyValue('visibility') == 'hidden') {
160				detected = true;
161			}
162		}
163		
164		if(this._options.debug === true) {
165			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'));
166		}
167		
168		if(loop === true) {
169			this._var.loopNumber++;
170			if(this._var.loopNumber >= this._options.loopMaxNumber) {
171				this._stopLoop();
172			}
173		}
174		
175		if(detected === true) {
176			this._stopLoop();
177			this._destroyBait();
178			this.emitEvent(true);
179			if(loop === true) {
180				this._var.checking = false;
181			}
182		} else if(this._var.loop === null || loop === false) {
183			this._destroyBait();
184			this.emitEvent(false);
185			if(loop === true) {
186				this._var.checking = false;
187			}
188		}
189	};
190	FuckAdBlock.prototype._stopLoop = function(detected) {
191		clearInterval(this._var.loop);
192		this._var.loop = null;
193		this._var.loopNumber = 0;
194		
195		if(this._options.debug === true) {
196			this._log('_stopLoop', 'A loop has been stopped');
197		}
198	};
199	
200	FuckAdBlock.prototype.emitEvent = function(detected) {
201		if(this._options.debug === true) {
202			this._log('emitEvent', 'An event with a '+(detected===true?'positive':'negative')+' detection was called');
203		}
204		
205		var fns = this._var.event[(detected===true?'detected':'notDetected')];
206		for(var i in fns) {
207			if(this._options.debug === true) {
208				this._log('emitEvent', 'Call function '+(parseInt(i)+1)+'/'+fns.length);
209			}
210			if(fns.hasOwnProperty(i)) {
211				fns[i]();
212			}
213		}
214		if(this._options.resetOnEnd === true) {
215			this.clearEvent();
216		}
217		return this;
218	};
219	FuckAdBlock.prototype.clearEvent = function() {
220		this._var.event.detected = [];
221		this._var.event.notDetected = [];
222		
223		if(this._options.debug === true) {
224			this._log('clearEvent', 'The event list has been cleared');
225		}
226	};
227	
228	FuckAdBlock.prototype.on = function(detected, fn) {
229		this._var.event[(detected===true?'detected':'notDetected')].push(fn);
230		if(this._options.debug === true) {
231			this._log('on', 'A type of event "'+(detected===true?'detected':'notDetected')+'" was added');
232		}
233		
234		return this;
235	};
236	FuckAdBlock.prototype.onDetected = function(fn) {
237		return this.on(true, fn);
238	};
239	FuckAdBlock.prototype.onNotDetected = function(fn) {
240		return this.on(false, fn);
241	};
242	
243	window.FuckAdBlock = FuckAdBlock;
244	
245	if(window.fuckAdBlock === undefined) {
246		window.fuckAdBlock = new FuckAdBlock({
247			checkOnLoad: true,
248			resetOnEnd: true
249		});
250	}
251})(window);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.