detect adblock javascript

JavaScript
      window.onload = function() {
        setTimeout(function() {
          var ad = document.querySelector("ins.adsbygoogle");
          if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
            ad.style.cssText = 'display:block !important';
            ad.innerHTML = "You seem to blocking Google AdSense ads in your browser.";
          }
        }, 2000);
      };
Source

Also in JavaScript: