Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save codeeshop-oc/46df03e8950e443b916d30c97f71ad63 to your computer and use it in GitHub Desktop.
Save codeeshop-oc/46df03e8950e443b916d30c97f71ad63 to your computer and use it in GitHub Desktop.
Reading Forbes Without Removing AdBlocker
/* Use Any Method */
========================================================
/*
With Chrome Extension install need - with extension you don't need to add it everyday
https://github.com/codeeshop-oc/custom-html-in-pages
*/
<script type="text/javascript" id="newday" async="true">
function removeAdBlockerIssue() {
let classes = [
{
key: 'body',
values: ['adblock-on', 'tp-modal-open']
},
{
key: '.tp-backdrop',
values: ['tp-active', 'tp-backdroptp-active']
}
]
for (let obj of classes) {
obj.values.forEach(v => {
document.querySelector(obj.key).classList.remove(v)
})
}
document.querySelector('.tp-modal').remove()
}
var limit = 20
var loader = setInterval(function () {
if(document.readyState !== "complete") return;
if(!limit || !document.querySelector('.tp-modal') && !document.querySelector('.tp-backdrop')) {
clearInterval(loader);
} else {
limit--
removeAdBlockerIssue()
}
}, 300);
</script>
========================================================
/*
Without Chrome Extension install need
Method 2
*/
document.querySelector('body').classList.remove('adblock-on')
document.querySelector('body').classList.remove('tp-modal-open')
document.querySelector('.tp-backdrop').classList.remove('tp-active')
document.querySelector('.tp-backdrop').classList.remove('tp-backdroptp-active')
document.querySelector('.tp-modal').remove()
========================================================
/*
Without Chrome Extension install need
Method 3
*/
let classes = [
{
key: 'body',
values: ['adblock-on', 'tp-modal-open']
},
{
key: '.tp-backdrop',
values: ['tp-active', 'tp-backdroptp-active']
}
]
for (let obj of classes) {
obj.values.forEach(v => {
document.querySelector(obj.key).classList.remove(v)
})
}
document.querySelector('.tp-modal').remove()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment