Skip to content

Instantly share code, notes, and snippets.

@arspuja
Last active February 18, 2021 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arspuja/64d087b69ab2912c1ac337bf9914f7d3 to your computer and use it in GitHub Desktop.
Save arspuja/64d087b69ab2912c1ac337bf9914f7d3 to your computer and use it in GitHub Desktop.
Simple Script for Detected Adblock Plugin on Blogger
<style>
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.adblck {
visibility: visible;
opacity: 1;
z-index: 999;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
text-align: center;
}
.popup h2 {
margin-top: 0;
color: #d70f0f;
font-family: Tahoma, Arial, sans-serif;
margin-bottom: 20px;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: #06D85F;
}
.popup .content {
max-height: 30%;
overflow: auto;
line-height: 2em;
}
@media screen and (max-width: 700px){
.box{
width: 70%;
}
.popup{
width: 70%;
}
}
</style>
<div id="popup1" class="overlay">
<div class="popup"><h2>Matikan ADBlock!</h2><div class="content">“Barang siapa yang menyulitkan (orang lain) maka Allah akan mempersulitnya pada hari kiamat” <br />(HR Al-Bukhari no 7152)</div></div>
</div>
<script>
window.onload = function() {
setInterval(function(){
var ad = document.querySelector("ins.adsbygoogle");
if(ad &amp;&amp; ad.innerHTML.replace(/\s/g, "").length === 0){
var ele = document.getElementById("popup1");
adcss = "adblck";
arr = ele.className.split(" ");
if (arr.indexOf(adcss) == -1) { ele.className += " " + adcss; }
}else{
var ele = document.getElementById("popup1");
ele.className = ele.className.replace(/\badblck\b/g, "");
}
}, 4000); };
</script>
@arspuja
Copy link
Author

arspuja commented Feb 18, 2021

HOW TO USE?

  1. Login to Blogger
  2. Enter the Themes menu -> Edit HTML
  3. Search and find the code "</body>"
  4. Paste the script code above the code "</body>"
  5. Save & Finish

BAGAIMANA CARA MENGGUNAKAN?

  1. Login ke Blogger
  2. Masuk menu Tema -> Edit HTML
  3. Cari kode "</body>"
  4. Paste kode script tersebut di atas kode "</body>"
  5. Simpan & Selesai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment