Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Twitter Ad Block
console.log('twitter ad block');
var clear = function () {
document.querySelectorAll('svg + div').forEach(function (a) {
if(a.textContent.search('Promoted') > -1) {
var p = a;
for(var c=0; c<7; c++){
if (p.tagName == 'A' && p.classList.contains('rn-1loqt21 ')) break;
p = p.parentElement;
}
if (p.classList.contains('rn-qklmqi') || p.classList.contains('rn-1loqt21 ')) {
console.log('ad blocked');
p.style.display = 'block';
}
}
});
};
var mutationObserver = new MutationObserver(clear);
mutationObserver.observe(document.documentElement, {
attributes: false,
characterData: false,
childList: true,
subtree: true,
attributeOldValue: false,
characterDataOldValue: false
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment