Skip to content

Instantly share code, notes, and snippets.

@techmuzz
Created May 24, 2019 22:51
Show Gist options
  • Save techmuzz/26f724d5c6dbada3dab57837103a3f11 to your computer and use it in GitHub Desktop.
Save techmuzz/26f724d5c6dbada3dab57837103a3f11 to your computer and use it in GitHub Desktop.
window.onload = function(){
setTimeout(function() {
var ad = document.querySelector("ins.adsbygoogle");
if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
alert("Please don't use Ad blocker on this site.");
var x = document.createElement("IMG");
x.setAttribute("src", "https://www.techmuzz.com/wp-content/uploads/2018/12/stop-ad-blockers.png");
x.setAttribute("width", "750");
x.setAttribute("height", "415");
x.setAttribute("alt", "Please don't use Ad blocker for this site.");
document.querySelectorAll("article").forEach(function(e) {
e.parentElement.appendChild(x);
e.remove();
});
}
}, 2000);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment