fix(browser-extension): issue #910
This commit is contained in:
parent
0fa2d371f0
commit
5890f81376
@ -6809,6 +6809,7 @@
|
|||||||
"[class$=\"UpdatePanelCookie\"]",
|
"[class$=\"UpdatePanelCookie\"]",
|
||||||
"[cnn-cookie-policy]",
|
"[cnn-cookie-policy]",
|
||||||
"[consent-skip-blocker][data-bg]",
|
"[consent-skip-blocker][data-bg]",
|
||||||
|
"[consent-skip-blocker][data-bg] > dialog",
|
||||||
"[cookie-unique-name]",
|
"[cookie-unique-name]",
|
||||||
"[css-main-site] #policy-div",
|
"[css-main-site] #policy-div",
|
||||||
"[data-acris-cookie-consent=\"true\"]",
|
"[data-acris-cookie-consent=\"true\"]",
|
||||||
@ -13869,5 +13870,5 @@
|
|||||||
"ytm-consent-bump-v2-renderer"
|
"ytm-consent-bump-v2-renderer"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"version": "1725705123996"
|
"version": "1725776505494"
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,12 @@ function clean(elements, skipMatch) {
|
|||||||
if (match(element, skipMatch)) {
|
if (match(element, skipMatch)) {
|
||||||
const observer = new MutationObserver(forceElementStyles);
|
const observer = new MutationObserver(forceElementStyles);
|
||||||
|
|
||||||
element.setAttribute(dataAttributeName, 'true');
|
if (element instanceof HTMLDialogElement) {
|
||||||
element.style.setProperty('display', 'none', 'important');
|
element.close();
|
||||||
|
} else {
|
||||||
|
element.setAttribute(dataAttributeName, 'true');
|
||||||
|
element.style.setProperty('display', 'none', 'important');
|
||||||
|
}
|
||||||
|
|
||||||
observer.observe(element, {
|
observer.observe(element, {
|
||||||
attributes: true,
|
attributes: true,
|
||||||
@ -185,8 +189,6 @@ function forceElementStyles(mutations, observer) {
|
|||||||
|
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
element.removeAttribute(dataAttributeName);
|
|
||||||
element.style.removeProperty('display');
|
|
||||||
} else {
|
} else {
|
||||||
element.style.setProperty('display', 'none', 'important');
|
element.style.setProperty('display', 'none', 'important');
|
||||||
}
|
}
|
||||||
@ -289,6 +291,8 @@ function match(element, skipMatch) {
|
|||||||
|
|
||||||
const hasAttributes = !!element.getAttributeNames().filter((x) => x !== 'data-nosnippet').length;
|
const hasAttributes = !!element.getAttributeNames().filter((x) => x !== 'data-nosnippet').length;
|
||||||
|
|
||||||
|
console.log(element);
|
||||||
|
|
||||||
if (!hasAttributes && !tagName.includes('-')) {
|
if (!hasAttributes && !tagName.includes('-')) {
|
||||||
forceClean(element);
|
forceClean(element);
|
||||||
}
|
}
|
||||||
@ -404,10 +408,13 @@ function restoreDOM() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const elements = getElements(`[${dataAttributeName}]`);
|
for (const element of removables) {
|
||||||
|
|
||||||
for (const element of elements) {
|
|
||||||
element.removeAttribute(dataAttributeName);
|
element.removeAttribute(dataAttributeName);
|
||||||
|
element.style.removeProperty('display');
|
||||||
|
|
||||||
|
if (element instanceof HTMLDialogElement) {
|
||||||
|
element.showModal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const element of [document.body, document.documentElement]) {
|
for (const element of [document.body, document.documentElement]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user