feat(script): remove html element margin-top

This commit is contained in:
wanhose 2020-06-11 13:08:29 +02:00
parent f20c420137
commit 8eeda96026
2 changed files with 8 additions and 3 deletions

View File

@ -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