diff --git a/database.json b/database.json index 6dcb85f..ae0da50 100644 --- a/database.json +++ b/database.json @@ -6809,6 +6809,7 @@ "[class$=\"UpdatePanelCookie\"]", "[cnn-cookie-policy]", "[consent-skip-blocker][data-bg]", + "[consent-skip-blocker][data-bg] > dialog", "[cookie-unique-name]", "[css-main-site] #policy-div", "[data-acris-cookie-consent=\"true\"]", @@ -13869,5 +13870,5 @@ "ytm-consent-bump-v2-renderer" ] }, - "version": "1725705123996" + "version": "1725776505494" } diff --git a/packages/browser-extension/src/scripts/content.js b/packages/browser-extension/src/scripts/content.js index e3e9639..a8d2b40 100644 --- a/packages/browser-extension/src/scripts/content.js +++ b/packages/browser-extension/src/scripts/content.js @@ -125,8 +125,12 @@ function clean(elements, skipMatch) { if (match(element, skipMatch)) { const observer = new MutationObserver(forceElementStyles); - element.setAttribute(dataAttributeName, 'true'); - element.style.setProperty('display', 'none', 'important'); + if (element instanceof HTMLDialogElement) { + element.close(); + } else { + element.setAttribute(dataAttributeName, 'true'); + element.style.setProperty('display', 'none', 'important'); + } observer.observe(element, { attributes: true, @@ -185,8 +189,6 @@ function forceElementStyles(mutations, observer) { if (value === null) { observer.disconnect(); - element.removeAttribute(dataAttributeName); - element.style.removeProperty('display'); } else { element.style.setProperty('display', 'none', 'important'); } @@ -289,6 +291,8 @@ function match(element, skipMatch) { const hasAttributes = !!element.getAttributeNames().filter((x) => x !== 'data-nosnippet').length; + console.log(element); + if (!hasAttributes && !tagName.includes('-')) { forceClean(element); } @@ -404,10 +408,13 @@ function restoreDOM() { } } - const elements = getElements(`[${dataAttributeName}]`); - - for (const element of elements) { + for (const element of removables) { element.removeAttribute(dataAttributeName); + element.style.removeProperty('display'); + + if (element instanceof HTMLDialogElement) { + element.showModal(); + } } for (const element of [document.body, document.documentElement]) {