/**
* NeverBlock
*
* Copyright (C) 2016 EXADS
*/
// noinspection JSUnusedGlobalSymbols
var ExoLoader;
(function () {
var version = '3.10';
var detection_started = false;
var detection_complete = false;
var adblock_detected = false;
var detector_func_queue = [];
var detector = {
domain_base: "exoclick.com",
detectCensorship: function (onComplete, timeout) {
detector_func_queue.push(onComplete);
detection_started = true;
var block = false;
var done = function () {
if (!detection_complete) {
try {
if (typeof window.notUseBlocker === "undefined") {
block = true;
}
} catch (err) {
block = true;
}
adblock_detected = block;
detection_complete = true;
} else {
block = adblock_detected;
}
do {
var currentFunction = detector_func_queue.shift();
if (typeof currentFunction === 'function') {
currentFunction(block);
}
} while (typeof currentFunction !== "undefined");
document.body.removeChild(testDomEl);
};
if (detection_complete) {
done();
return;
}
var testDomEl = document.createElement('iframe'),
randomNum = Math.floor(Math.random() * (10000 - 123 + 1)) + 123,
id = 'adsbox_ex_' + randomNum;
testDomEl.setAttribute('height', "1px");
testDomEl.setAttribute('width', "1px");
testDomEl.setAttribute('id', id);
testDomEl.setAttribute('class', 'adsBox pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links');
testDomEl.setAttribute('style', "width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important; box-sizing: content-box !important; border-width: 0px !important;");
try {
if (window.ExoLoader === null) {
window.ExoLoader = {'dummy': 1};
if (window.ExoLoader !== {'dummy': 1}) {
block = true;
}
}
} catch (err) {
block = true;
}
var testScript = document.createElement('script');
testScript.src = detector.domain_base + "/js/openad.js";
testScript.onerror = function () {
block = true;
};
document.body.appendChild(testDomEl);
document.head.appendChild(testScript);
var isTimeoutSet = false;
var timeUp = false;
var timeoutExceeded = function (thistimer) {
timeUp = true;
clearTimeout(thistimer);
};
var loadedCheck = function (timeoutCycle) {
setTimeout(function () {
timeoutCycle--;
if (typeof exoDocumentProtocol !== 'undefined' ) {
//File loaded successfully
clearTimeout(timeupTimer);
} else if (timeoutCycle > 0 && document.readyState !== "complete" && !timeUp) {
loadedCheck(timeoutCycle);
} else {
domDetect();
done();
clearTimeout(timeupTimer);
}
}, 0);
};
if(timeout) {
var timeupTimer = setTimeout(function () {
timeoutExceeded(timeupTimer);
}, timeout);
isTimeoutSet = true;
loadedCheck(timeout);
}
var domDetect = function () {
try {
var someAd = document.getElementById(id);
if (someAd === null
|| someAd.style.display === "none"
|| someAd.style.display === "hidden"
|| someAd.style.visibility === "hidden"
|| someAd.offsetParent === null
|| someAd.offsetHeight === 0
|| someAd.offsetLeft === 0
|| someAd.offsetTop === 0
|| someAd.offsetWidth === 0
|| someAd.clientHeight === 0
|| someAd.clientWidth === 0
) {
block = true;
}
if (window.getComputedStyle !== undefined) {
var style = window.getComputedStyle(someAd, null);
if (style && (style.getPropertyValue('display') === 'none' || style.getPropertyValue('visibility') === 'hidden')) {
block = true;
}
}
} catch (err) {
}
};
var maxReadyCheckAttempts = 45;
var readyCheckInterval = setInterval(function () {
if(isTimeoutSet) {
clearInterval(readyCheckInterval);
return;
}
if (document.readyState === "complete" || maxReadyCheckAttempts === 0 || block === true) {
domDetect();
done();
clearInterval(readyCheckInterval);
}
maxReadyCheckAttempts--;
}, 50);
}
};
function urlDomain(url) {
var a = document.createElement('a');
a.href = url;
return a.hostname;
}
var stylesheet = "{ %optional_styles% vertical-align:top; cursor: pointer; border: 0px solid #000000; display: inline-block; background-color: rgba(0, 0, 0, 0); margin: 0px 0px; padding: 0px 0px; }";
var debug_messages = [];
var error_messages = [];
var request_stack = [];// array of request objects
var responses = {};
var callback_function_pushed_to_detector = false;
var request_started = false;
var current_request = 0;
var waiting_request_queue = [];
var before_detect_queue = [];
var ZonesRequest = function() {
this.zone_params = [];
this.dom = [];
this.pushZone = function(zoneParams) {
this.zone_params.push(zoneParams);
};
this.pushDom = function(domObj) {
this.dom.push(domObj);
};
};
var addDebugMessage = function (message) {
var date = new Date();
debug_messages.push(date.toISOString() + ": " + message);
};
var addErrorMessage = function (message) {
var date = new Date();
error_messages.push(date.toISOString() + ": " + message);
console.error(message);
};
var URLToArray = function(url) {
var request = {};
var pairs = url.substring(url.indexOf('?') + 1).split('&');
for (var i = 0; i < pairs.length; i++) {
if(!pairs[i])
continue;
var pair = pairs[i].split('=');
request[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
}
return request;
};
var stringify = function (value) {
var reassign_when_finished = false;
if (typeof Array.prototype.toJSON !== 'undefined') {
reassign_when_finished = true;
var array_to_json = Array.prototype.toJSON;
delete Array.prototype.toJSON;
}
var val = JSON.stringify(value);
if (reassign_when_finished) {
Array.prototype.toJSON = array_to_json;
}
return val;
};
var randStr = function (length, possibleChars)
{
var text = "";
var possible = possibleChars || "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < length; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
};
var createStyle = function (doc, dom_anchor, style_text)
{
var class_name = randStr(1,"abcdefghijklmnopqrstuvwxyz") + randStr(7);
style_text = "." + class_name + " " + style_text;
var style = doc.createElement('style');
style.setAttribute('type', 'text/css');
style.innerHTML = style_text;
dom_anchor.parentNode.insertBefore(style, dom_anchor);
return class_name;
};
// noinspection JSUnusedGlobalSymbols
var loader = {
bl_domain: null,
bl_cookie_domain: null,
timeout_check: null,
no_cookie: false,
cookie_name: "yuo1",
setTimeout: function(timeout) {
if(timeout) {
loader.timeout_check = timeout;
}
},
addZone: function(params) {
if (typeof params !== 'object'
|| typeof params.idzone === 'undefined'
) {
addErrorMessage("addZone() invalid params");
return false;
}
if (params.hasOwnProperty('container') && params.container !== null) params['container'] = document.getElementById(params['container']);
if (params.hasOwnProperty('container') && params.container === null) delete params['container'];
// noinspection JSUnresolvedVariable
var doc = params.doc || document;
var scripts = doc.getElementsByTagName('script');
// The current