Anti-Adblock Script for Blogger

<!-- Start Anti-Adblock Script for Blogger -->
<style type='text/css'>
/*<![CDATA[*/
#adblock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}
#adblock-overlay.active {
    visibility: visible;
    opacity: 1;
}
.adblock-box {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-family: 'Segoe UI', Arial, sans-serif;
    animation: slideDown 0.4s ease-out;
}
@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.adblock-icon {
    width: 60px;
    height: 60px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: bold;
    margin: 0 auto 20px auto;
}
.adblock-box h2 {
    margin: 0 0 15px;
    color: #2f3542;
    font-size: 24px;
}
.adblock-box p {
    color: #57606f;
    line-height: 1.6;
    margin-bottom: 25px;
}
.adblock-btn {
    background: #ff4757;
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}
.adblock-btn:hover {
    background: #ff6b81;
}
/*]]>*/
</style>
<div id='adblock-overlay'>
    <div class='adblock-box'>
        <div class='adblock-icon'>!</div>
        <h2>Ad-Blocker Detected</h2>
        <p>It looks like you are using an ad-blocking extension. We rely on ads to keep our content free. Please whitelist our site and refresh the page to continue reading.</p>
        <button class='adblock-btn' onclick='location.reload()'>I have disabled it, Reload</button>
    </div>
</div>
<script type='text/javascript'>
//<![CDATA[
(function() {
    function detectAdBlock() {
        // 1. Create a bait element with common ad class names
        let bait = document.createElement('div');
        bait.innerHTML = '&nbsp;';
        bait.className = 'adsbox ad-banner ad-unit doubleclick ad-zone';
        bait.style.position = 'absolute';
        bait.style.top = '-9999px';
        bait.style.left = '-9999px';
        bait.style.height = '1px';
        bait.style.width = '1px';
        document.body.appendChild(bait);
        // 2. Wait a brief moment to allow adblocker to process the element
        setTimeout(function() {
            let isBlocked = bait.offsetHeight === 0 || 
                            bait.style.display === 'none' || 
                            window.getComputedStyle(bait).getPropertyValue('display') === 'none';
            if (isBlocked) {
                // Adblock detected: Show overlay and prevent scrolling
                document.getElementById('adblock-overlay').classList.add('active');
                document.body.style.overflow = 'hidden'; 
            }
            // 3. Clean up the bait
            document.body.removeChild(bait);
        }, 300);
    }
    // Run script after the page fully loads
    window.addEventListener('load', detectAdBlock);
})();
//]]>
</script>
<!-- End Anti-Adblock Script -->{codeBox}
Seiha_Shop

👋 Hi, I'm Seiha a passionate Designer and Web Motion Artist based in Phnom Penh. I specialize in crafting visually compelling designs and dynamic web experiences that bring brands to life. With a keen eye for aesthetics and a love for movement, I blend creativity with technology to create interfaces that don’t just look good!.. They feel alive. Whether it's UI/UX design, interactive animations, or motion graphics for the web, I thrive on turning ideas into immersive digital stories. Let's build something beautiful together.

Post a Comment

Previous Post Next Post

AdBlock Detected!

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.