Brawl Stars

Brawl Stars

All trademarks belong to their respective owners.

Advertisement
Image source - play.google.com

Get from the official digital markets

All trademarks belong to their respective owners.

', googletag.enums.OutOfPageFormat.REWARDED).addService(googletag.pubads()); rewardedSlot.setForceSafeFrame(true); googletag.pubads().enableAsyncRendering(); googletag.enableServices(); googletag.pubads().addEventListener('rewardedSlotReady', function(evt) { evt.makeRewardedVisible(); }); googletag.pubads().addEventListener('rewardedSlotClosed', function(evt) { adInProgress = false; adClosed = true; if(linkNew == false){ checkAndRedirect(); } }); googletag.display(rewardedSlot); }); } const modal = document.getElementById("myModal"); const closeBtn = document.getElementById("closeBtn"); const unlockBtn = document.getElementById("unlockBtn"); const countdownSpan = document.getElementById('countdown'); const modalMessage = document.getElementById('modalMessage'); const rewardButton = document.getElementById('reward-button'); // Hàm bắt đầu đếm ngược function startCountdown() { countdown = 3; let autoClicked = false; countdownSpan.textContent = countdown; countdownInterval = setInterval(() => { countdown--; countdownSpan.textContent = countdown; if (countdown <= 0 && !autoClicked) { clearInterval(countdownInterval); autoClickUnlock(); } }, 1000); } function resetCountdown() { clearInterval(countdownInterval); countdown = 3; countdownSpan.textContent = countdown; autoClicked = false; } rewardButton.onclick = function() { modal.style.display = "block"; startCountdown(); } function autoClickUnlock() { autoClicked = true; unlockBtn.click(); } closeBtn.onclick = function() { modal.style.display = "none"; resetCountdown(); if (adInProgress) { adClosed = false; } } document.getElementById('unlockBtn').addEventListener('click', function() { modal.style.display = "none"; showRewardAd(); resetCountdown(); }); function checkAndRedirect() { if (rewarded && adClosed) { window.location.href = "https://zokigames.com/h5-game/"; } } window.addEventListener('load', function() { googletag.cmd.push(function() { googletag.pubads().addEventListener('rewardedSlotGranted', function(evt) { rewarded = true; if(linkNew == false){ checkAndRedirect(); } }); }); }); $('.product-btns button').click(function(){ linkNew = $(this).attr('data-href'); $('#modal-ask-accept').css('display', 'block'); }); $('#modal-ask-accept .close').click(function() { $('#modal-ask-accept').css('display', 'none'); }) $('#modal-ask-accept .unlock').click(function(){ $('#modal-ask-accept').css('display', 'none'); showRewardAdButton(linkNew); }) function showRewardAdButton(link) { console.log('Reward Ad Button Clicked'); googletag.cmd.push(function() { const rewardedSlot = googletag.defineOutOfPageSlot('
', googletag.enums.OutOfPageFormat.REWARDED).addService(googletag.pubads()); rewardedSlot.setForceSafeFrame(true); googletag.pubads().enableAsyncRendering(); googletag.enableServices(); googletag.pubads().addEventListener('rewardedSlotReady', function(evt) { evt.makeRewardedVisible(); }); googletag.pubads().addEventListener('rewardedSlotClosed', function(evt) { adInProgress = false; adClosed = true; if(linkNew != false) { checkAndRedirectButton(link); } }); googletag.display(rewardedSlot); }); } function checkAndRedirectButton(openLink) { if (rewarded && adClosed) { $('.unlock-accept-download').attr('href',openLink); $('#modal-accept-download').css('display', 'block'); } } $('#modal-accept-download .close').click(function() { $('#modal-accept-download').css('display', 'none'); }) $('#modal-accept-download .unlock-accept-download').click(function() { $('#modal-accept-download').css('display', 'none'); }) });