<!-- Anti-AdBlock CSS & Modal -->
<style>
/*<![CDATA[*/
#adblock-overlay {
display: none; /* Hidden by default */
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0, 0, 0, 0.85);
z-index: 999999;
justify-content: center;
align-items: center;
backdrop-filter: blur(5px);
}
.adblock-box {
background: #ffffff;
padding: 35px;
border-radius: 12px;
text-align: center;
max-width: 420px;
width: 90%;
box-shadow: 0 15px 35px rgba(0,0,0,0.4);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
/* Logo Styling */
.adblock-logo {
max-width: 250px; /* Adjusted to fit your rectangular logo better */
height: auto;
margin-bottom: 20px;
display: inline-block;
}
.adblock-box h2 {
margin-top: 0;
color: #e74c3c;
font-size: 24px;
}
.adblock-box p {
color: #555555;
line-height: 1.6;
margin-bottom: 25px;
font-size: 16px;
}
.adblock-btn {
background: #3498db;
color: #ffffff;
padding: 12px 24px;
text-decoration: none;
border-radius: 6px;
font-weight: 600;
display: inline-block;
cursor: pointer;
transition: background 0.3s ease;
border: none;
}
.adblock-btn:hover {
background: #2980b9;
}
/*]]>*/
</style>
<!-- AdBlock Bait Element (Do not remove) -->
<div class="ad-placement ad-banner adsbox ad-slot" id="detect-ad-bait" style="position:absolute; top:-999px; width:1px; height:1px; opacity:0; pointer-events:none;"></div>
<!-- Anti-AdBlock Overlay HTML -->
<div id="adblock-overlay">
<div class="adblock-box">
<!-- Self-closing tag required by Blogger XML -->
<img src="https://i.postimg.cc/YSR6tQzB/logo-ads.png" alt="AdBlock Notice" class="adblock-logo" />
<h2>AdBlock Detected!</h2>
<p>It looks like you are using an ad-blocking extension. Our website relies on ad revenue to keep the content free. Please support us by disabling your ad blocker for our site.</p>
<button class="adblock-btn" onclick="location.reload()">I have disabled it</button>
</div>
</div>
<!-- Anti-AdBlock JavaScript -->
<script type="text/javascript">
//<![CDATA[
document.addEventListener("DOMContentLoaded", function() {
// Wait 1.5 seconds to ensure adblockers have finished scanning the page
setTimeout(function() {
var bait = document.getElementById("detect-ad-bait");
var overlay = document.getElementById("adblock-overlay");
var isBlocked = false;
// Check if the element was completely removed from the DOM
if (!bait) {
isBlocked = true;
}
// Check if the element's dimensions were squashed to 0
else if (bait.offsetHeight === 0 || bait.offsetWidth === 0) {
isBlocked = true;
}
// Check if the element was hidden via CSS injection
else {
var style = window.getComputedStyle(bait);
if (style.display === "none" || style.visibility === "hidden") {
isBlocked = true;
}
}
// Trigger the overlay if blocked
if (isBlocked) {
overlay.style.display = "flex";
document.body.style.overflow = "hidden"; // Prevents background scrolling
}
}, 1500);
});
//]]>
</script>{codeBox}
ដាក់ខាងលើ៊/body
ReplyDelete