Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(window) {
- // CONFIGURATION SELON SITE
- ATSiteID = '516058';
- ATServeur = 'http://logI242.xiti.com';
- if ("https:" == document.location.protocol){
- ATServeur = 'https://logs1125.xiti.com';
- }
- LIENFermeture = '//cdn-analytics.ladmedia.fr/sports/ablocker/png/close.png';
- LIENStep1='//cdn-analytics.ladmedia.fr/sports/ablocker/png/step1.png';
- LIENStep2='//cdn-analytics.ladmedia.fr/sports/ablocker/png/step2.png';
- LIENStep3='//cdn-analytics.ladmedia.fr/sports/ablocker/png/step3.png';
- var FkABlock = function(options) {
- this._options = {
- checkOnLoad: true,
- resetOnEnd: true,
- loopCheckTime: 6000,
- loopMaxNumber: 3,
- baitClass: 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links',
- baitStyle: 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;',
- debug: true
- };
- this._var = {
- version: '3.2.0',
- bait: null,
- checking: false,
- loop: null,
- loopNumber: 0,
- event: { detected: [], notDetected: [] }
- };
- if(options !== undefined) {
- this.setOption(options);
- }
- var self = this;
- var eventCallback = function() {
- setTimeout(function() {
- if(self._options.checkOnLoad === true) {
- if(self._options.debug === true) {
- self._log('onload->eventCallback', 'A check loading is launched');
- }
- if(self._var.bait === null) {
- self._creatBait();
- }
- setTimeout(function() {
- self.check();
- }, 1);
- }
- }, 1);
- };
- if(window.addEventListener !== undefined) {
- window.addEventListener('load', eventCallback, false);
- } else {
- window.attachEvent('onload', eventCallback);
- }
- };
- FkABlock.prototype._options = null;
- FkABlock.prototype._var = null;
- FkABlock.prototype._bait = null;
- FkABlock.prototype._log = function(method, message) {
- };
- FkABlock.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];
- if(this._options.debug === true) {
- this._log('setOption', 'The option "'+option+'" he was assigned to "'+options[option]+'"');
- }
- }
- return this;
- };
- FkABlock.prototype._creatBait = function() {
- //console.log( FkABlock.prototype._creatBait );
- var bait = document.createElement('div');
- bait.setAttribute('class', this._options.baitClass);
- bait.setAttribute('style', this._options.baitStyle);
- this._var.bait = window.document.body.appendChild(bait);
- this._var.bait.offsetParent;
- this._var.bait.offsetHeight;
- this._var.bait.offsetLeft;
- this._var.bait.offsetTop;
- this._var.bait.offsetWidth;
- this._var.bait.clientHeight;
- this._var.bait.clientWidth;
- if(this._options.debug === true) {
- this._log('_creatBait', 'Bait has been created');
- }
- };
- FkABlock.prototype._destroyBait = function() {
- window.document.body.removeChild(this._var.bait);
- this._var.bait = null;
- if(this._options.debug === true) {
- this._log('_destroyBait', 'Bait has been removed');
- }
- };
- FkABlock.prototype.check = function(loop) {
- //console.log('FkABlock.prototype.check called')
- if(loop === undefined) {
- loop = true;
- }
- if(this._options.debug === true) {
- this._log('check', 'An audit was requested '+(loop===true?'with a':'without')+' loop');
- }
- if(this._var.checking === true) {
- if(this._options.debug === true) {
- this._log('check', 'A check was canceled because there is already an ongoing');
- }
- return false;
- }
- this._var.checking = true;
- if(this._var.bait === null) {
- //console.log('CREATBAIT')
- this._creatBait();
- }
- var self = this;
- this._var.loopNumber = 0;
- if(loop === true) {
- this._var.loop = setInterval(function() {
- self._checkBait(loop);
- }, this._options.loopCheckTime);
- }
- setTimeout(function() {
- self._checkBait(loop);
- }, 1);
- if(this._options.debug === true) {
- this._log('check', 'A check is in progress ...');
- }
- return true;
- };
- FkABlock.prototype._checkBait = function(loop) {
- var detected = false;
- //console.log('FkABlock.prototype._checkBait')
- if(this._var.bait === null) {
- this._creatBait();
- }
- if(window.document.body.getAttribute('abp') !== null
- || this._var.bait.offsetParent === null
- || this._var.bait.offsetHeight == 0
- || this._var.bait.offsetLeft == 0
- || this._var.bait.offsetTop == 0
- || this._var.bait.offsetWidth == 0
- || this._var.bait.clientHeight == 0
- || this._var.bait.clientWidth == 0) {
- detected = true;
- }
- if(window.getComputedStyle !== undefined) {
- var baitTemp = window.getComputedStyle(this._var.bait, null);
- if(baitTemp.getPropertyValue('display') == 'none'
- || baitTemp.getPropertyValue('visibility') == 'hidden') {
- detected = true;
- }
- }
- if(this._options.debug === true) {
- 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'));
- }
- if(loop === true) {
- this._var.loopNumber++;
- if(this._var.loopNumber >= this._options.loopMaxNumber) {
- this._stopLoop();
- }
- }
- if(detected === true) {
- this._stopLoop();
- this._destroyBait();
- this.emitEvent(true);
- if(loop === true) {
- this._var.checking = false;
- }
- } else if(this._var.loop === null || loop === false) {
- this._destroyBait();
- this.emitEvent(false);
- if(loop === true) {
- this._var.checking = false;
- }
- }
- };
- FkABlock.prototype._stopLoop = function(detected) {
- clearInterval(this._var.loop);
- this._var.loop = null;
- this._var.loopNumber = 0;
- if(this._options.debug === true) {
- this._log('_stopLoop', 'A loop has been stopped');
- }
- };
- FkABlock.prototype.emitEvent = function(detected) {
- if(this._options.debug === true) {
- this._log('emitEvent', 'An event with a '+(detected===true?'positive':'negative')+' detection was called');
- }
- var fns = this._var.event[(detected===true?'detected':'notDetected')];
- for(var i in fns) {
- if(this._options.debug === true) {
- this._log('emitEvent', 'Call function '+(parseInt(i)+1)+'/'+fns.length);
- }
- if(fns.hasOwnProperty(i)) {
- fns[i]();
- }
- }
- if(this._options.resetOnEnd === true) {
- this.clearEvent();
- }
- return this;
- };
- FkABlock.prototype.clearEvent = function() {
- this._var.event.detected = [];
- this._var.event.notDetected = [];
- if(this._options.debug === true) {
- this._log('clearEvent', 'The event list has been cleared');
- }
- };
- FkABlock.prototype.on = function(detected, fn) {
- this._var.event[(detected===true?'detected':'notDetected')].push(fn);
- if(this._options.debug === true) {
- this._log('on', 'A type of event "'+(detected===true?'detected':'notDetected')+'" was added');
- }
- return this;
- };
- FkABlock.prototype.onDetected = function(fn) {
- return this.on(true, fn);
- };
- FkABlock.prototype.onNotDetected = function(fn) {
- return this.on(false, fn);
- };
- window.FkABlock = FkABlock;
- if(window.fabInstance === undefined) {
- window.fabInstance = new FkABlock({
- checkOnLoad: true,
- resetOnEnd: true
- });
- }
- // custom LA code
- // // Function called if AdBlock is not detected
- function adBlockNotDetected() {
- if( typeof tC.getCookie === 'function' && document.cookie.match('adblockEnabled') && tC.getCookie('adblockEnabled') === "1" ){
- // adblock was activated before, and has been unactivated since.
- $('body').prepend('<div id="merci" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 99999; background-color: rgba(0,0,0,0.6);"><div style="width: 100%; max-width: 900px; position: fixed; top: 15%; left: 0; right: 0; margin: auto; background-color: #ffffff; z-index: 10000; padding: 20px"><div style="text-align: right; height: 22px"><img class="bt_close" style="cursor: pointer;display:inline; width: auto;" src="'+ATServeur+'/go.url?xts='+ATSiteID+'&ati=INT-101&atc=INT-101&type=AT&rn='+tc_random+'&url='+LIENFermeture+'" alt="Fermer" title="Fermer"></div><div style="font-family: arial; font-size: 24px; line-height: 32px; max-width: 755px; margin: 20px auto 50px auto;">Vous avez désactivé votre bloqueur de publicités.<br /><strong style="font-weight: bold;">Merci de votre soutien</strong> et bonne lecture !</div></div></div></div>');
- $('.bt_close').bind('click',function(){
- $('#merci').remove();
- });
- // update cookie
- var dTC = new Date();
- dTC.setTime(dTC.getTime()+(7*24*60*60*1000));
- document.cookie = "adblockEnabled=0;expires="+dTC.toGMTString()+";path=/;domain="+tc_maindomain+"";
- // adserver cookies for desactivation
- (new Image()).src= "http://ad.doctissimo.fr/RealMedia/ads/adstream.cap?" + Math.floor((Math.random() * 100) + 1) + "&c=docintrusif&e=10d&s=1&n=ad.doctissimo.fr";
- (new Image()).src= "http://pr.a2dfp.net/r/r?idm[]=598:2592000";
- }
- if ( tC.internalvars.adblock === "0" ) {
- return;
- }
- tC.internalvars.adblock = "0";
- }
- // Function called if AdBlock is detected
- function adBlockDetected() {
- if ( tC.internalvars.adblock === "1" ) {
- return;
- }
- tC.internalvars.adblock = "1";
- $('body').prepend('<div id='+tc_random+'><div id='+tc_random+' style="width: 100%; max-width: 900px; position: fixed; top: 5%; left: 0; right: 0; margin: auto; background-color: #ffffff; z-index: 999999; padding: 20px"><div style="text-align: right; height: 22px"><div class="bt_close" style="cursor: pointer;display:none" Onclick="return xt_adc(this, \'INT-100-[fermeture]\')" alt="Fermer" title="Fermer"><img src="'+LIENFermeture+'" style="display:inline; width: auto;"></div></div> <div style="font-family: arial; font-size: 24px; line-height: 32px; max-width: 755px; margin: 20px auto 30px auto;">Bonjour,<strong style="display: block;font-weight: bold;">Il semblerait que vous utilisez un bloqueur de publicités.</strong></div><div style="font-family: arial; font-size: 16px; line-height: 24px; max-width: 755px; margin: 0 auto 35px auto;">La publicité est notre <strong style="font-weight: bold;">unique source de revenus</strong>.<br />Pour que nous puissions continuer à vous proposer des contenus de qualité, nous vous remercions d‘autoriser la publicité sur notre site.</div><div style="font-family: arial; font-size: 16px; line-height: 24px; max-width: 755px; margin: 0 auto 40px auto;">Pour cela, rien de plus simple :</div><div style="max-width: 770px; margin: 0 auto 20px auto; text-align: center;"><img style="display:inline; width: auto;" src="'+LIENStep1+'" alt=""></img><img style="display:inline; width: auto;" src="'+LIENStep2+'" alt=""><a href="'+tc_url_no_query+'" Onclick="return xt_adc(this, \'INT-100-[recharger]\')"><img style="display:inline; width: auto;" src="'+ATServeur+'/go.url?xts='+ATSiteID+'&ati=INT-100&atc=INT-100&type=AT&rn='+tc_random+'&url='+LIENStep3+'"></a></div></div><div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10000; background-color: rgba(0,0,0,0.6);"></div></div></div>');
- $('.bt_close').delay(3000).fadeIn(100);
- $('.bt_close').bind('click',function(){
- $('#'+tc_random+'').remove();
- });
- // creation cookie
- if(!document.cookie.match('adblockEnabled') || ( document.cookie.match('adblockEnabled') && typeof tC.getCookie === 'function' && tC.getCookie('adblockEnabled') === "0" )){
- var dTC = new Date();
- dTC.setTime(dTC.getTime()+(7*24*60*60*1000));
- document.cookie = "adblockEnabled=1;expires="+dTC.toGMTString()+";path=/;domain="+tc_maindomain+"";
- }
- }
- // Recommended audit because AdBlock lock the file 'fucktC.internalvars.adblock.js'
- // If the file is not called, the variable does not exist 'fabInstance'
- // This means that AdBlock is present
- if(typeof fabInstance === 'undefined') {
- adBlockDetected();
- } else {
- fabInstance.onDetected(adBlockDetected);
- fabInstance.onNotDetected(adBlockNotDetected);
- // and|or
- fabInstance.on(true, adBlockDetected);
- fabInstance.on(false, adBlockNotDetected);
- // and|or
- fabInstance.on(true, adBlockDetected).onNotDetected(adBlockNotDetected);
- }
- // Change the options
- fabInstance.setOption('checkOnLoad', true);
- //fabInstance.setOption('loopTime', 5000 );
- })(window);
Advertisement
Add Comment
Please, Sign In to add comment