diff --git a/data/skips.txt b/data/skips.txt index 79d4d39..1adb556 100644 --- a/data/skips.txt +++ b/data/skips.txt @@ -1,3 +1,4 @@ +accounts.google.com canvasjs.com chessmadra.com correos.es @@ -5,6 +6,7 @@ flickr.com godotforums.org key-shortcut.com lever.co +login.microsoftonline.com mantisbt.org musicmeter.nl personio.com diff --git a/packages/browser-extension/src/scripts/content.js b/packages/browser-extension/src/scripts/content.js index bdeaffd..4906e6c 100644 --- a/packages/browser-extension/src/scripts/content.js +++ b/packages/browser-extension/src/scripts/content.js @@ -131,22 +131,17 @@ const match = (node, skipMatch) => { const fix = () => { const backdrop = document.getElementsByClassName('modal-backdrop')[0]; + const facebook = document.getElementsByClassName('_31e')[0]; + const fixes = data?.fixes ?? []; + const skips = data?.skips ?? []; - if (backdrop && backdrop.children.length === 0) { + if (backdrop?.children.length === 0) { backdrop.remove(); } - document.getElementsByClassName('_31e')[0]?.classList.remove('_31e'); + facebook?.classList.remove('_31e'); - if (data?.skips.length && !data.skips.includes(hostname)) { - for (const item of [document.body, document.documentElement]) { - item?.classList.remove(...(data?.classes ?? [])); - item?.style.setProperty('position', 'initial', 'important'); - item?.style.setProperty('overflow-y', 'initial', 'important'); - } - } - - for (const fix of data?.fixes ?? []) { + for (const fix of fixes) { const [match, selector, action, property] = fix.split('##'); if (hostname.includes(match)) { @@ -176,6 +171,16 @@ const fix = () => { } } } + + if (!skips.includes(hostname)) { + dispatch({ type: 'INSERT_CONTENT_CSS' }); + + for (const item of [document.body, document.documentElement]) { + item?.classList.remove(...(data?.classes ?? [])); + item?.style.setProperty('position', 'initial', 'important'); + item?.style.setProperty('overflow-y', 'initial', 'important'); + } + } }; /** @@ -220,7 +225,6 @@ window.addEventListener('pageshow', (event) => { if (state.enabled) { data = await dispatch({ hostname, type: 'GET_DATA' }); dispatch({ type: 'ENABLE_ICON' }); - dispatch({ type: 'INSERT_CONTENT_CSS' }); observer.observe(document.body ?? document.documentElement, options); } })();