From 8eeda96026a8347f63a786598f5f7c3c67e1c9b2 Mon Sep 17 00:00:00 2001 From: wanhose Date: Thu, 11 Jun 2020 13:08:29 +0200 Subject: [PATCH] feat(script): remove html element margin-top --- src/js/modules/constants.js | 2 +- src/js/modules/script.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/js/modules/constants.js b/src/js/modules/constants.js index 097eb27..fe7cbe2 100644 --- a/src/js/modules/constants.js +++ b/src/js/modules/constants.js @@ -3,4 +3,4 @@ export const UNTOUCHABLE_SITES = [ 'www.gamemania.be', 'www.guysandstthomas.nhs.uk', 'www.youtube.com', -]; \ No newline at end of file +]; diff --git a/src/js/modules/script.js b/src/js/modules/script.js index 10e7a76..1019d1c 100644 --- a/src/js/modules/script.js +++ b/src/js/modules/script.js @@ -30,6 +30,7 @@ const doMagic = () => { // Fixing main elements if (!UNTOUCHABLE_SITES.includes(document.location.host)) { + document.documentElement.style.setProperty('margin-top', 'unset', 'important'); document.documentElement.style.setProperty('overflow', 'unset', 'important'); document.documentElement.style.setProperty('position', 'unset', 'important'); document.body.style.setProperty('overflow', 'unset', 'important'); @@ -37,7 +38,11 @@ const doMagic = () => { // Remove irritating all removable elements removable.forEach(element => { - if (element.tagName !== 'body' && element.tagName !== 'html') { + const isRemovable = + element.tagName.toLowerCase() !== 'body' + && element.tagName.toLowerCase() !== 'html'; + + if (isRemovable) { const exists = document.getElementById(element.id) || document.getElementsByName(element.name).length > 0 @@ -70,4 +75,4 @@ const observe = () => { // Then... disableCookies(); doMagic(); -observe(); \ No newline at end of file +observe();