/*!
{
  "name": "Ad block",
  "tags": ["adblock"],
  "authors": ["Ivan Nikolić"],
  "async": true
}
!*/
/* jshint expr: true */

define(['Modernizr', 'createElement', 'docElement', 'addTest'], function( Modernizr, createElement, docElement, addTest ) {
  Modernizr.addAsyncTest(function() {

    var isInDom;
    var el = createElement('img');
    el.src = '//ads.modernizr';
    el.style.width = '1px';
    el.style.height = '1px';
    el.style.position = 'absolute';

    docElement.appendChild(el);

    setTimeout(function(){

      isInDom = docElement.contains(el);

      addTest('adblock', !isInDom);

      isInDom && docElement.removeChild(el);
      el = null;

    },200);

  });
});

@@ -293,23 +293,37 @@
     var 
-isInDom
+adblockActive = false
 ;%0A    va
@@ -477,16 +477,269 @@
 lute';%0A%0A
+    // IE8 complains if we try to append element to HTML element%0A    // Since it certainly doesn%E2%80%99t have ad blocker, we automatically return false%0A    if ( document.all && !document.addEventListener ) %7B%0A%0A      addTest('adblock', false);%0A%0A    %7D else %7B%0A%0A  
     docE
@@ -759,24 +759,26 @@
 Child(el);%0A%0A
+  
     setTimeo
@@ -803,18 +803,27 @@
     
-isInDom
+  adblockActive
  = 
+!
 docE
@@ -837,27 +837,59 @@
 contains(el)
+ %7C%7C el.style.display == 'none'
 ;%0A%0A
+  
       addTes
@@ -905,33 +905,46 @@
 k', 
-!isInDom);%0A%0A      isInDom
+adblockActive);%0A%0A        adblockActive
  && 
@@ -977,16 +977,18 @@
 ;%0A      
+  
 el = nul
@@ -995,16 +995,18 @@
 l;%0A%0A    
+  
 %7D,200);%0A
@@ -1006,16 +1006,23 @@
 ,200);%0A%0A
+    %7D%0A%0A
   %7D);%0A%7D)

Modify ad blocking test