[Modified/Added] Ad-Blocker Detection Code Added
This commit is contained in:
@@ -9,4 +9,82 @@
|
||||
gtag('config', 'G-JMDDTT0Y7C');
|
||||
</script>
|
||||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7252354354222007"
|
||||
crossorigin="anonymous"></script>
|
||||
crossorigin="anonymous" onerror="adBlockFunction();"></script>
|
||||
|
||||
<!-- detect Ad-Blocker and display error pop up -->
|
||||
<script>
|
||||
function adBlockFunction() {
|
||||
console.log('Add Blocker Detected');
|
||||
let adp_underlay = document.createElement('div');
|
||||
adp_underlay.className = 'adp-underlay';
|
||||
document.body.appendChild(adp_underlay);
|
||||
let adp = document.createElement('div');
|
||||
adp.className = 'adp';
|
||||
adp.innerHTML = `
|
||||
<image src='./exclamation-mark.png' class='img' />
|
||||
<h2>AdBlock Detected!</h2>
|
||||
<p>Sorry. We detected that you have activated Ad-Blocker. <br />
|
||||
Please Consider supporting us by disabling your Ad-Blocker It helps us in maintaining this website.<br />
|
||||
To View the content disable Ad-Blocker and refresh the page. Thank You !!!</p>
|
||||
`;
|
||||
document.body.appendChild(adp);
|
||||
adp.querySelector('a').onclick = e => {
|
||||
e.preventDefault();
|
||||
document.body.removeChild(adp_underlay);
|
||||
document.body.removeChild(adp);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.img{
|
||||
height: 2rem;
|
||||
width: 2rem;
|
||||
}
|
||||
.adp {
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
flex-flow: column;
|
||||
position: fixed;
|
||||
z-index: 99999;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 22rem;
|
||||
height: 20rem;
|
||||
background-color: #ffffff;
|
||||
padding: 20px;
|
||||
border-radius: 5px;
|
||||
align-items: center;
|
||||
}
|
||||
.adp h2 {
|
||||
border-bottom: 1px solid #eee;
|
||||
margin: 0;
|
||||
padding: 15px 0;
|
||||
}
|
||||
.adp p {
|
||||
flex-grow: 1;
|
||||
}
|
||||
.adp a {
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
width: 100%;
|
||||
background-color: #366ed8;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
color: #ffffff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.adp a:hover {
|
||||
background-color: #3368cc;
|
||||
}
|
||||
.adp-underlay {
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 99998;
|
||||
}
|
||||
</style>
|
||||
BIN
exclamation-mark.png
Normal file
BIN
exclamation-mark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
BIN
sections/exclamation-mark.png
Normal file
BIN
sections/exclamation-mark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
Reference in New Issue
Block a user