diff --git a/manifest.json b/manifest.json index a88744c..0dce97e 100644 --- a/manifest.json +++ b/manifest.json @@ -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": { diff --git a/scripts/content.js b/scripts/content.js index 2a5c0ef..277617d 100644 --- a/scripts/content.js +++ b/scripts/content.js @@ -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 */