diff --git a/data/elements.txt b/data/elements.txt index b2ea854..aee659e 100644 --- a/data/elements.txt +++ b/data/elements.txt @@ -12501,4 +12501,5 @@ body > div[data-nosnippet="true"] > aside epaas-consent-drawer-shell .epaas-notavailable-banner .cbar -.cbar-overlay \ No newline at end of file +.cbar-overlay +div[style="overflow: hidden; position: absolute; top: 0px; width: 379px; z-index: 991; height: 180px; margin-top: 70px; right: 0px; margin-right: 25px;"] \ No newline at end of file diff --git a/manifest.json b/manifest.json index f636d96..c29ed63 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Cookie Dialog Monster", - "version": "5.3.2", + "version": "5.3.3", "default_locale": "en", "description": "__MSG_appDesc__", "icons": { @@ -20,7 +20,6 @@ "content_scripts": [ { "all_frames": true, - "css": ["styles/fixes.css"], "exclude_matches": ["*://*.gfycat.com/*"], "js": ["scripts/content.js"], "matches": ["http://*/*", "https://*/*"], @@ -34,5 +33,5 @@ "storage", "tabs" ], - "web_accessible_resources": ["assets/fonts/*", "scripts/*", "styles/*"] + "web_accessible_resources": ["assets/fonts/*", "scripts/popup.js", "styles/*"] } diff --git a/scripts/content.js b/scripts/content.js index ab646f7..248567b 100644 --- a/scripts/content.js +++ b/scripts/content.js @@ -12,11 +12,17 @@ let classes = []; const dispatch = chrome.runtime.sendMessage; +/** + * @description Hostname + */ + +const hostname = document.location.hostname; + /** * @description Is consent preview page? */ -const isConsentPreview = document.location.host.startsWith("consent."); +const isConsentPreview = hostname.startsWith("consent."); /** * @description Options provided to observer @@ -54,12 +60,22 @@ const clean = () => { */ const fix = () => { + const automobiel = /automobielmanagement.nl/g.test(hostname); const body = document.body; const facebook = document.getElementsByClassName("_31e")[0]; const google = document.querySelector('form[action*="consent.google"]'); const html = document.documentElement; + const play = hostname.startsWith("play.google."); const yahoo = document.querySelector("#consent-page"); + if (automobiel && body) { + for (let i = body.childNodes.length; i--; ) { + const node = body.childNodes[i]; + if (node instanceof HTMLElement) + node.style.setProperty("filter", "initial", "important"); + } + } + if (body) { if (classes.length) body.classList.remove(...classes); body.style.setProperty("overflow-y", "initial", "important"); @@ -71,7 +87,8 @@ const fix = () => { } if (google) { - google.querySelector("button").click(); + const submit = google.querySelector("button"); + if (submit) submit.click(); } if (html) { @@ -80,8 +97,14 @@ const fix = () => { html.style.setProperty("overflow-y", "initial", "important"); } + if (play) { + const element = document.querySelector("body > div"); + if (element) element.style.setProperty("z-index", "initial", "important"); + } + if (yahoo) { - yahoo.querySelector('button[type="submit"]').click(); + const submit = yahoo.querySelector('button[type="submit"]'); + if (submit) submit.click(); } }; @@ -149,18 +172,14 @@ document.addEventListener("readystatechange", () => { * @description Setups everything and starts to observe if enabled */ -dispatch( - { hostname: document.location.hostname, type: "GET_CACHE" }, - null, - async ({ enabled }) => { - dispatch({ type: "ENABLE_POPUP" }); +dispatch({ hostname, type: "GET_CACHE" }, null, async ({ enabled }) => { + dispatch({ type: "ENABLE_POPUP" }); - if (enabled) { - dispatch({ type: "ENABLE_ICON" }); - const results = await Promise.all([setupClasses(), setupSelectors()]); - classes = results[0].classes; - selectors = results[1].selectors; - observer.observe(target, options); - } + if (enabled) { + dispatch({ type: "ENABLE_ICON" }); + const results = await Promise.all([setupClasses(), setupSelectors()]); + classes = results[0].classes; + selectors = results[1].selectors; + observer.observe(target, options); } -); +}); diff --git a/styles/fixes.css b/styles/fixes.css deleted file mode 100644 index 26af5d2..0000000 --- a/styles/fixes.css +++ /dev/null @@ -1,3 +0,0 @@ -body > * { - filter: initial !important; -}