Skip to content

Instantly share code, notes, and snippets.

@korrio
Created October 7, 2025 05:36
Show Gist options
  • Save korrio/837c9441297a8ca72be03ff337d5c2a2 to your computer and use it in GitHub Desktop.
Save korrio/837c9441297a8ca72be03ff337d5c2a2 to your computer and use it in GitHub Desktop.
ads-gone.js
// Hide images in ad containers
document.querySelectorAll('[class*="ad"], [id*="ad"], [class*="banner"], [id*="banner"]').forEach(el => {
el.querySelectorAll('img').forEach(img => {
img.style.display = 'none';
});
});
// Also hide images with ad-related attributes
document.querySelectorAll('img').forEach(img => {
const allText = (img.src + img.alt + img.className + img.id).toLowerCase();
if (/ad|banner|sponsor|promo/i.test(allText)) {
img.style.display = 'none';
}
});
console.log('Ad images and containers hidden');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment