Guest User

Untitled

a guest
Mar 21st, 2016
1,508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function(window) {
  2.    
  3.     // CONFIGURATION SELON SITE
  4.     ATSiteID = '517037';
  5.     ATServeur = 'http://logc279.xiti.com';
  6.     if ("https:" == document.location.protocol){
  7.             ATServeur = 'https://logs1242.xiti.com';
  8.             }
  9.    
  10.     LIENFermeture = '//cdn-analytics.ladmedia.fr/europe1/ablocker/png/close.png';
  11.    
  12.     LIENStep1='//cdn-analytics.ladmedia.fr/europe1/ablocker/png/step1.png';
  13.     LIENStep2='//cdn-analytics.ladmedia.fr/europe1/ablocker/png/step2.png';
  14.     LIENStep3='//cdn-analytics.ladmedia.fr/europe1/ablocker/png/step3.png';
  15.  
  16.     var FkABlock = function(options) {
  17.        
  18.         this._options = {
  19.             checkOnLoad:        true,
  20.             resetOnEnd:         true,
  21.             loopCheckTime:      6000,
  22.             loopMaxNumber:      3,
  23.             baitClass:          'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links',
  24.             baitStyle:          'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;',
  25.             debug:              true
  26.         };
  27.         this._var = {
  28.             version:            '3.2.0',
  29.             bait:               null,
  30.             checking:           false,
  31.             loop:               null,
  32.             loopNumber:         0,
  33.             event:              { detected: [], notDetected: [] }
  34.         };
  35.         if(options !== undefined) {
  36.             this.setOption(options);
  37.         }
  38.         var self = this;
  39.         var eventCallback = function() {
  40.             setTimeout(function() {
  41.                 if(self._options.checkOnLoad === true) {
  42.                     if(self._options.debug === true) {
  43.                         self._log('onload->eventCallback', 'A check loading is launched');
  44.                     }
  45.                     if(self._var.bait === null) {
  46.                         self._creatBait();
  47.                     }
  48.                     setTimeout(function() {
  49.                         self.check();
  50.                     }, 1);
  51.                 }
  52.             }, 1);
  53.         };
  54.         if(window.addEventListener !== undefined) {
  55.             window.addEventListener('load', eventCallback, false);
  56.         } else {
  57.             window.attachEvent('onload', eventCallback);
  58.         }
  59.     };
  60.     FkABlock.prototype._options = null;
  61.     FkABlock.prototype._var = null;
  62.     FkABlock.prototype._bait = null;
  63.    
  64.     FkABlock.prototype._log = function(method, message) {
  65.  
  66.     };
  67.    
  68.     FkABlock.prototype.setOption = function(options, value) {
  69.         if(value !== undefined) {
  70.             var key = options;
  71.             options = {};
  72.             options[key] = value;
  73.         }
  74.         for(var option in options) {
  75.             this._options[option] = options[option];
  76.             if(this._options.debug === true) {
  77.                 this._log('setOption', 'The option "'+option+'" he was assigned to "'+options[option]+'"');
  78.             }
  79.         }
  80.         return this;
  81.     };
  82.    
  83.     FkABlock.prototype._creatBait = function() {
  84.  
  85.         //console.log( FkABlock.prototype._creatBait );
  86.         var bait = document.createElement('div');
  87.             bait.setAttribute('class', this._options.baitClass);
  88.             bait.setAttribute('style', this._options.baitStyle);
  89.         this._var.bait = window.document.body.appendChild(bait);
  90.        
  91.         this._var.bait.offsetParent;
  92.         this._var.bait.offsetHeight;
  93.         this._var.bait.offsetLeft;
  94.         this._var.bait.offsetTop;
  95.         this._var.bait.offsetWidth;
  96.         this._var.bait.clientHeight;
  97.         this._var.bait.clientWidth;
  98.        
  99.         if(this._options.debug === true) {
  100.             this._log('_creatBait', 'Bait has been created');
  101.         }
  102.     };
  103.     FkABlock.prototype._destroyBait = function() {
  104.         window.document.body.removeChild(this._var.bait);
  105.         this._var.bait = null;
  106.        
  107.         if(this._options.debug === true) {
  108.             this._log('_destroyBait', 'Bait has been removed');
  109.         }
  110.     };
  111.    
  112.     FkABlock.prototype.check = function(loop) {
  113.  
  114.         //console.log('FkABlock.prototype.check called')
  115.         if(loop === undefined) {
  116.             loop = true;
  117.         }
  118.        
  119.         if(this._options.debug === true) {
  120.             this._log('check', 'An audit was requested '+(loop===true?'with a':'without')+' loop');
  121.         }
  122.        
  123.         if(this._var.checking === true) {
  124.             if(this._options.debug === true) {
  125.                 this._log('check', 'A check was canceled because there is already an ongoing');
  126.             }
  127.             return false;
  128.         }
  129.         this._var.checking = true;
  130.        
  131.         if(this._var.bait === null) {
  132.             //console.log('CREATBAIT')
  133.             this._creatBait();
  134.         }
  135.        
  136.         var self = this;
  137.         this._var.loopNumber = 0;
  138.         if(loop === true) {
  139.             this._var.loop = setInterval(function() {
  140.                 self._checkBait(loop);
  141.             }, this._options.loopCheckTime);
  142.         }
  143.         setTimeout(function() {
  144.             self._checkBait(loop);
  145.         }, 1);
  146.         if(this._options.debug === true) {
  147.             this._log('check', 'A check is in progress ...');
  148.         }
  149.        
  150.         return true;
  151.     };
  152.     FkABlock.prototype._checkBait = function(loop) {
  153.         var detected = false;
  154.            
  155.         //console.log('FkABlock.prototype._checkBait')
  156.         if(this._var.bait === null) {
  157.             this._creatBait();
  158.         }
  159.        
  160.         if(window.document.body.getAttribute('abp') !== null
  161.         || this._var.bait.offsetParent === null
  162.         || this._var.bait.offsetHeight == 0
  163.         || this._var.bait.offsetLeft == 0
  164.         || this._var.bait.offsetTop == 0
  165.         || this._var.bait.offsetWidth == 0
  166.         || this._var.bait.clientHeight == 0
  167.         || this._var.bait.clientWidth == 0) {
  168.             detected = true;
  169.         }
  170.         if(window.getComputedStyle !== undefined) {
  171.             var baitTemp = window.getComputedStyle(this._var.bait, null);
  172.             if(baitTemp.getPropertyValue('display') == 'none'
  173.             || baitTemp.getPropertyValue('visibility') == 'hidden') {
  174.                 detected = true;
  175.             }
  176.         }
  177.        
  178.         if(this._options.debug === true) {  
  179.             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'));
  180.         }
  181.        
  182.         if(loop === true) {
  183.             this._var.loopNumber++;
  184.             if(this._var.loopNumber >= this._options.loopMaxNumber) {
  185.                 this._stopLoop();
  186.             }
  187.         }
  188.        
  189.         if(detected === true) {
  190.             this._stopLoop();
  191.             this._destroyBait();
  192.             this.emitEvent(true);
  193.             if(loop === true) {
  194.                 this._var.checking = false;
  195.             }
  196.         } else if(this._var.loop === null || loop === false) {
  197.             this._destroyBait();
  198.             this.emitEvent(false);
  199.             if(loop === true) {
  200.                 this._var.checking = false;
  201.             }
  202.         }
  203.     };
  204.     FkABlock.prototype._stopLoop = function(detected) {
  205.         clearInterval(this._var.loop);
  206.         this._var.loop = null;
  207.         this._var.loopNumber = 0;
  208.        
  209.         if(this._options.debug === true) {
  210.             this._log('_stopLoop', 'A loop has been stopped');
  211.         }
  212.     };
  213.    
  214.     FkABlock.prototype.emitEvent = function(detected) {
  215.         if(this._options.debug === true) {
  216.             this._log('emitEvent', 'An event with a '+(detected===true?'positive':'negative')+' detection was called');
  217.         }
  218.        
  219.         var fns = this._var.event[(detected===true?'detected':'notDetected')];
  220.         for(var i in fns) {
  221.             if(this._options.debug === true) {
  222.                 this._log('emitEvent', 'Call function '+(parseInt(i)+1)+'/'+fns.length);
  223.             }
  224.             if(fns.hasOwnProperty(i)) {
  225.                 fns[i]();
  226.             }
  227.         }
  228.         if(this._options.resetOnEnd === true) {
  229.             this.clearEvent();
  230.         }
  231.         return this;
  232.     };
  233.     FkABlock.prototype.clearEvent = function() {
  234.         this._var.event.detected = [];
  235.         this._var.event.notDetected = [];
  236.        
  237.         if(this._options.debug === true) {
  238.             this._log('clearEvent', 'The event list has been cleared');
  239.         }
  240.     };
  241.    
  242.     FkABlock.prototype.on = function(detected, fn) {
  243.         this._var.event[(detected===true?'detected':'notDetected')].push(fn);
  244.         if(this._options.debug === true) {
  245.             this._log('on', 'A type of event "'+(detected===true?'detected':'notDetected')+'" was added');
  246.         }
  247.        
  248.         return this;
  249.     };
  250.     FkABlock.prototype.onDetected = function(fn) {
  251.         return this.on(true, fn);
  252.     };
  253.     FkABlock.prototype.onNotDetected = function(fn) {
  254.         return this.on(false, fn);
  255.     };
  256.    
  257.     window.FkABlock = FkABlock;
  258.    
  259.     if(window.fabInstance === undefined) {
  260.         window.fabInstance = new FkABlock({
  261.             checkOnLoad: true,
  262.             resetOnEnd: true
  263.         });
  264.     }
  265.  
  266.  
  267.  
  268.  
  269.     //  custom LA code
  270.     //  // Function called if AdBlock is not detected
  271.     function adBlockNotDetected() {
  272.  
  273.         if( typeof tC.getCookie === 'function' && document.cookie.match('adblockEnabled') && tC.getCookie('adblockEnabled') === "1" ){
  274.  
  275.             // adblock was activated before, and has been unactivated since.
  276.                 $('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&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&eacute;sactiv&eacute; votre bloqueur de publicit&eacute;s.<br /><strong style="font-weight: bold;">Merci de votre soutien</strong> et bonne lecture !</div></div></div></div>');
  277.  
  278.                     $('.bt_close').bind('click',function(){
  279.                         $('#merci').remove();
  280.                     });
  281.            
  282.                    
  283.                 // update cookie
  284.                     var dTC = new Date();
  285.                     dTC.setTime(dTC.getTime()+(7*24*60*60*1000));
  286.                     document.cookie = "adblockEnabled=0;expires="+dTC.toGMTString()+";path=/;domain="+tc_maindomain+"";
  287.                    
  288.                 // adserver cookies for desactivation
  289.  
  290.                         (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";
  291.                        
  292.                         (new Image()).src= "http://pr.a2dfp.net/r/r?idm[]=598:2592000";
  293.  
  294.         }
  295.  
  296.         if ( tC.internalvars.adblock === "0" ) {
  297.             return;
  298.         }
  299.        
  300.         tC.internalvars.adblock = "0";
  301.        
  302.     }
  303.  
  304.     // Function called if AdBlock is detected
  305.     function adBlockDetected() {
  306.  
  307.         if ( tC.internalvars.adblock === "1" ) {
  308.             return;
  309.         }
  310.        
  311.         tC.internalvars.adblock = "1";
  312.        
  313.     $('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&eacute;s.</strong></div><div style="font-family: arial; font-size: 16px; line-height: 24px; max-width: 755px; margin: 0 auto 35px auto;">La publicit&eacute; est notre <strong style="font-weight: bold;">unique source de revenus</strong>.<br />Pour que nous puissions continuer &agrave; vous proposer des contenus de qualit&eacute;, nous vous remercions d&#145;autoriser la publicit&eacute; 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&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>');
  314.        
  315.         $('.bt_close').delay(3000).fadeIn(100);
  316.            
  317.         $('.bt_close').bind('click',function(){
  318.                 $('#'+tc_random+'').remove();
  319.             });
  320.        
  321.        
  322.         $('.bt_close').delay(3000).fadeIn(100);
  323.            
  324.         $('.bt_close').bind('click',function(){
  325.                 $('#'+tc_random+'').remove();
  326.             });
  327.  
  328.  
  329.         // creation cookie
  330.         if(!document.cookie.match('adblockEnabled') || ( document.cookie.match('adblockEnabled') && typeof tC.getCookie === 'function' &&  tC.getCookie('adblockEnabled') === "0"  )){
  331.             var dTC = new Date();
  332.             dTC.setTime(dTC.getTime()+(7*24*60*60*1000));
  333.             document.cookie = "adblockEnabled=1;expires="+dTC.toGMTString()+";path=/;domain="+tc_maindomain+"";
  334.         }
  335.  
  336.  
  337.     }
  338.  
  339.     // Recommended audit because AdBlock lock the file 'fucktC.internalvars.adblock.js'
  340.     // If the file is not called, the variable does not exist 'fabInstance'
  341.     // This means that AdBlock is present
  342.     if(typeof fabInstance === 'undefined') {
  343.         adBlockDetected();
  344.     } else {
  345.         fabInstance.onDetected(adBlockDetected);
  346.         fabInstance.onNotDetected(adBlockNotDetected);
  347.         // and|or
  348.         fabInstance.on(true, adBlockDetected);
  349.         fabInstance.on(false, adBlockNotDetected);
  350.         // and|or
  351.         fabInstance.on(true, adBlockDetected).onNotDetected(adBlockNotDetected);
  352.     }
  353.  
  354.     // Change the options
  355.     fabInstance.setOption('checkOnLoad', true);
  356.     //fabInstance.setOption('loopTime', 5000 );
  357.  
  358.  
  359. })(window);
Advertisement
Add Comment
Please, Sign In to add comment