-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.js
27 lines (21 loc) · 1.06 KB
/
content.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function removeWafflesPortalIfIframeExists(observer) {
const targetNormalIframe = document.querySelector('iframe.iframe-modal[src*="https://upsell-dialogs.datacamp.com/templates/paywall?user_id="]');
const targetDiscountIframe = document.querySelector('iframe.iframe-modal[src*="https://upsell-dialogs.datacamp.com/templates/paywall_sitewide"]');
if (targetNormalIframe || targetDiscountIframe) {
console.log("Iframe encontrado. Tentando remover a div waffles-portal-root.");
const wafflesDiv = document.querySelector('#waffles-portal-root');
if (wafflesDiv) {
wafflesDiv.closest('#waffles-portal-root').remove();
console.log("Div 'waffles-portal-root' removida.");
}
} else {
console.log("Iframe não encontrado. A div waffles-portal-root não foi removida.");
}
}
const observer = new MutationObserver((mutations) => {
mutations.forEach(() => {
removeWafflesPortalIfIframeExists(observer);
});
});
observer.observe(document.body, { childList: true, subtree: true });
removeWafflesPortalIfIframeExists(observer);