Merge pull request #22 from wanhose/5.3.1

5.3.1
This commit is contained in:
wanhose 2021-11-06 14:48:01 +01:00 committed by GitHub
commit 49bc4ab22d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 5 deletions

View File

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Cookie Dialog Monster",
"version": "5.3.0",
"version": "5.3.1",
"default_locale": "en",
"description": "__MSG_appDesc__",
"icons": {

View File

@ -31,6 +31,18 @@ let selectors = "";
const target = document.body || document.documentElement;
/**
* @description Cleans DOM
*/
const clean = () => {
if (selectors.length) {
const results = document.querySelectorAll(selectors);
for (let i = results.length; i--; ) results[i].outerHTML = "";
}
};
/**
* @description Fixes scroll issues
*/
@ -40,10 +52,21 @@ const fix = () => {
const facebook = document.getElementsByClassName("_31e")[0];
const html = document.documentElement;
if (body && classes.length > 0) body.classList.remove(...classes);
if (body) body.style.setProperty("overflow-y", "unset", "important");
if (facebook) facebook.style.setProperty("position", "unset", "important");
if (html) html.style.setProperty("overflow-y", "unset", "important");
if (body) {
if (classes.length) body.classList.remove(...classes);
body.style.setProperty("overflow-y", "initial", "important");
body.style.setProperty("position", "initial", "important");
}
if (facebook) {
facebook.style.setProperty("position", "initial", "important");
}
if (html) {
if (classes.length) html.classList.remove(...classes);
html.style.setProperty("position", "initial", "important");
html.style.setProperty("overflow-y", "initial", "important");
}
};
const observer = new MutationObserver((mutations, instance) => {
@ -89,6 +112,17 @@ const setupSelectors = () =>
dispatch({ type: "GET_SELECTORS" }, null, resolve);
});
/**
* @description Listens DOM complete state
*/
document.addEventListener("readystatechange", () => {
if (document.readyState === "complete") {
clean();
setTimeout(clean, 2000);
}
});
/**
* @description Setups everything and starts to observe if enabled
*/