Guest User

Untitled

a guest
Jan 5th, 2016
1,635
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   // http://megogo.net/ru/view/1817491-krasotka-lyalya.html
  2.   window.adBlock = false;
  3.  
  4.   (function (window) {
  5.     var _dot = null;
  6.  
  7.     function createDot() {
  8.       var dot = null;
  9.       var dotClass = 'text-ad permads adplacement text-ads popexit adsonar ads-180x Ads_Billboard adService advertisement-icon';
  10.       var dotStyle = 'position: absolute !important; top: -1000px !important; left: -10000px !important; width: 1px !important; height: 1px !important;';
  11.  
  12.       dot = document.createElement('div');
  13.       dot.setAttribute('class', dotClass);
  14.       dot.setAttribute('style', dotStyle);
  15.  
  16.       _dot = document.body.appendChild(dot);
  17.     }
  18.  
  19.     function checkDot() {
  20.       if (_dot === null) {
  21.         createDot();
  22.       }
  23.  
  24.       setTimeout(function () {
  25.         if (document.body.getAttribute('abp') !== null
  26.            || _dot.offsetParent === null
  27.            || _dot.offsetHeight == 0
  28.            || _dot.offsetLeft == 0
  29.            || _dot.offsetTop == 0
  30.            || _dot.offsetWidth == 0
  31.            || _dot.clientHeight == 0
  32.            || _dot.clientWidth == 0) {
  33.           window.adBlock = true;
  34.         }
  35.  
  36.         if (window.getComputedStyle !== undefined) {
  37.           var dotTemp = window.getComputedStyle(_dot, null);
  38.  
  39.           if (dotTemp.getPropertyValue('display') == 'none'
  40.              || dotTemp.getPropertyValue('visibility') == 'hidden') {
  41.             window.adBlock = true;
  42.           }
  43.         }
  44.  
  45.         destroyDot();
  46.  
  47.         if (true == window.adBlock && (playerFrame = document.getElementById('playerFrame'))) {
  48.           try {
  49.             playerFrame.contentWindow.showAdBlockMessage();
  50.           } catch (error) {}
  51.         }
  52.       }, 50);
  53.     }
  54.  
  55.     function destroyDot() {
  56.       document.body.removeChild(_dot);
  57.       _dot = null;
  58.     }
  59.  
  60.     if (window.addEventListener) {
  61.       window.addEventListener('load', checkDot, false);
  62.     } else {
  63.       window.attachEvent('onload', checkDot);
  64.     }
  65.   })(window);
Advertisement
Add Comment
Please, Sign In to add comment