Skip to content

Commit

Permalink
Please help us to maintain this project by disabling your Advertising…
Browse files Browse the repository at this point in the history
… blocker on our page
  • Loading branch information
saribe authored Sep 11, 2024
1 parent 88a7b32 commit b50673e
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,28 @@ $(document)
// }

function _checkAds() {
setTimeout(function () {
var isBlocked = !$('.adsbygoogle')[0].children.length;

let isBlocked = false;

fetch('https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js')
.then(() => { isBlocked = false; })
.catch(() => {
isBlocked = true;

eModal.confirm('Please help us to maintain this project by disabling your Advertising blocker on our page. :(', 'Advertising blocker not allowed')
.then(() => location.reload());

$("h4, code, strong, td").text(function (_, ctx) {
return ctx.replace(/\b/g, " AdBlock ");
});
})
.finally(() => {
if (window.ga) {
window.ga('send', 'event', 'adBlock', isBlocked ? 'blocked' : 'allowed');
}
if (isBlocked) {
eModal.confirm('Please help us to maintain this project by disabling your Advertising blocker in our page. :(', 'Advertising blocker not allowed')
.then(function () {
location.reload();
});

$("h4, code, strong, td").text(function (_, ctx) {
return ctx.replace(/\b/g, " AdBlock ");
});
}
}, 5000);
console.log(`AdBlock Enabled: ${isBlocked}`)
});


}
//#endregion
});

0 comments on commit b50673e

Please sign in to comment.