Remove MissAV advertisements, iframes and popup ads.
// ==UserScript==
// @name MissAV Ad Cleaner
// @namespace http://tampermonkey.net/
// @version 1.1
// @author ChatGPT
// @license MIT
// @description Remove MissAV advertisements, iframes and popup ads.
// @include /^https?:\/\/missav[^/]*\//
// @run-at document-start
// @grant none
// ==/UserScript==
(function () {
'use strict';
const selector = 'iframe, #html-ads, #inpage, #SCSpotScript';
// Block popup advertisements.
const open = window.open;
window.open = function (url, ...args) {
try {
const u = new URL(url, location.href);
if (u.origin === location.origin &&
u.pathname === '/pop' &&
u.searchParams.has('url')) return null;
} catch {}
return open.call(this, url, ...args);
};
// Hide ad elements immediately.
const style = document.createElement('style');
style.textContent = `${selector} {
display: none !important;
visibility: hidden !important;
}`;
const clean = node => {
if (node.nodeType !== 1 && node !== document) return;
if (node.nodeType === 1 && node.matches(selector)) {
node.remove();
return;
}
node.querySelectorAll?.(selector).forEach(el => el.remove());
};
// Watch dynamically inserted elements.
new MutationObserver(records => {
if (document.documentElement && !style.isConnected) {
document.documentElement.appendChild(style);
}
for (const record of records) {
record.addedNodes.forEach(clean);
}
}).observe(document, {
childList: true,
subtree: true
});
// Initial cleanup.
if (document.documentElement) {
document.documentElement.appendChild(style);
}
clean(document);
})();