fix(browser-extension): issue #910
This commit is contained in:
parent
0fa2d371f0
commit
5890f81376
@ -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"
|
||||
}
|
||||
|
@ -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]) {
|
||||
|
Loading…
Reference in New Issue
Block a user