From 611390400dadfc94281d5c5c3356e62e794d3679 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 18:05:12 +0530 Subject: [PATCH 1/8] remove if else --- src/email-recovery.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/email-recovery.js b/src/email-recovery.js index ea9d797..8e1ecdd 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -24,7 +24,8 @@ document.addEventListener('DOMContentLoaded', function() { setTopStyle('#header', bannerHeight) if (document.querySelector('#content')) { setMarginTopAndHeight('#content', topHeight) - } else { + } + if (document.querySelector('#content-vue')) { setMarginTopAndHeight('#content-vue', topHeight) } setTopStyleWhenElementAvailable('#header-menu-user-menu', topHeight) -- GitLab From 7a5ab36acc8a1d01c158ac058541e7c5aaf35d2c Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 18:14:48 +0530 Subject: [PATCH 2/8] remove if else --- src/email-recovery.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/email-recovery.js b/src/email-recovery.js index 8e1ecdd..3ef29bf 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -105,8 +105,10 @@ function setTopStyle(selector, topValue) { * @param topValue */ function setMarginTopAndHeight(selector, topValue) { + console.log("hello1") const element = document.querySelector(selector) if (element) { + console.log("hello2") element.style.cssText += `margin-top: ${topValue} !important;` const heightValue = `calc(100% - env(safe-area-inset-bottom) - ${topValue} - var(--body-container-margin)) !important` element.style.cssText += `height: ${heightValue};` -- GitLab From f41d2c4ba366e4710f1eb904e53ed0222832e6a4 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 18:18:44 +0530 Subject: [PATCH 3/8] remove if else --- src/email-recovery.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/email-recovery.js b/src/email-recovery.js index 3ef29bf..091278e 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -105,6 +105,7 @@ function setTopStyle(selector, topValue) { * @param topValue */ function setMarginTopAndHeight(selector, topValue) { + /* eslint-disable no-console */ console.log("hello1") const element = document.querySelector(selector) if (element) { -- GitLab From c8f869859ee548809189d36e9191fa0b85024388 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 18:20:39 +0530 Subject: [PATCH 4/8] lint fix --- src/email-recovery.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/email-recovery.js b/src/email-recovery.js index 091278e..53e63e7 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -106,10 +106,10 @@ function setTopStyle(selector, topValue) { */ function setMarginTopAndHeight(selector, topValue) { /* eslint-disable no-console */ - console.log("hello1") + console.log('hello1') const element = document.querySelector(selector) if (element) { - console.log("hello2") + console.log('hello2') element.style.cssText += `margin-top: ${topValue} !important;` const heightValue = `calc(100% - env(safe-area-inset-bottom) - ${topValue} - var(--body-container-margin)) !important` element.style.cssText += `height: ${heightValue};` -- GitLab From de25e8256a3d20381bac467c61d5e3e8d97f4b10 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 18:24:32 +0530 Subject: [PATCH 5/8] lint fix --- src/email-recovery.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/email-recovery.js b/src/email-recovery.js index 53e63e7..8e10d0a 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -25,7 +25,10 @@ document.addEventListener('DOMContentLoaded', function() { if (document.querySelector('#content')) { setMarginTopAndHeight('#content', topHeight) } + /* eslint-disable no-console */ + console.log('here1') if (document.querySelector('#content-vue')) { + console.log('here2') setMarginTopAndHeight('#content-vue', topHeight) } setTopStyleWhenElementAvailable('#header-menu-user-menu', topHeight) -- GitLab From 7d4665c02d16d13f4e808cdc907e545050eb4fd5 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 18:39:39 +0530 Subject: [PATCH 6/8] adjust for bookmarks --- src/email-recovery.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/email-recovery.js b/src/email-recovery.js index 8e10d0a..3118422 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -31,6 +31,17 @@ document.addEventListener('DOMContentLoaded', function() { console.log('here2') setMarginTopAndHeight('#content-vue', topHeight) } + if (window.location.href.includes('apps/bookmarks/')) { + const intervalId = setInterval(() => { + console.log('here test') + const contentVue = document.querySelector('#content-vue') + if (contentVue) { + console.log('Element #content-vue added dynamically') + setMarginTopAndHeight('#content-vue', topHeight) + clearInterval(intervalId); // Stop checking once the element is found + } + }, 100) // Check every 100 milliseconds + } setTopStyleWhenElementAvailable('#header-menu-user-menu', topHeight) setTopStyleWhenElementAvailable('#header-menu-notifications', topHeight) setTopStyle('#header-menu-unified-search', topHeight) -- GitLab From e1b3a329d56d3615584226ecdcf30d8f3e9e211a Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 18:41:43 +0530 Subject: [PATCH 7/8] adjust for bookmarks --- src/email-recovery.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/email-recovery.js b/src/email-recovery.js index 3118422..42397dc 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -38,10 +38,10 @@ document.addEventListener('DOMContentLoaded', function() { if (contentVue) { console.log('Element #content-vue added dynamically') setMarginTopAndHeight('#content-vue', topHeight) - clearInterval(intervalId); // Stop checking once the element is found + clearInterval(intervalId) // Stop checking once the element is found } - }, 100) // Check every 100 milliseconds - } + }, 100) // Check every 100 milliseconds + } setTopStyleWhenElementAvailable('#header-menu-user-menu', topHeight) setTopStyleWhenElementAvailable('#header-menu-notifications', topHeight) setTopStyle('#header-menu-unified-search', topHeight) -- GitLab From eb1fd3c182f121d28af4236daed2ffd5a80dd534 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 13 Aug 2024 18:45:49 +0530 Subject: [PATCH 8/8] adjust for bookmarks --- src/email-recovery.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/email-recovery.js b/src/email-recovery.js index 42397dc..aa78186 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -24,23 +24,18 @@ document.addEventListener('DOMContentLoaded', function() { setTopStyle('#header', bannerHeight) if (document.querySelector('#content')) { setMarginTopAndHeight('#content', topHeight) - } - /* eslint-disable no-console */ - console.log('here1') - if (document.querySelector('#content-vue')) { - console.log('here2') + } else { setMarginTopAndHeight('#content-vue', topHeight) } + // added special case for bookmarks if (window.location.href.includes('apps/bookmarks/')) { const intervalId = setInterval(() => { - console.log('here test') const contentVue = document.querySelector('#content-vue') if (contentVue) { - console.log('Element #content-vue added dynamically') setMarginTopAndHeight('#content-vue', topHeight) - clearInterval(intervalId) // Stop checking once the element is found + clearInterval(intervalId) } - }, 100) // Check every 100 milliseconds + }, 100) } setTopStyleWhenElementAvailable('#header-menu-user-menu', topHeight) setTopStyleWhenElementAvailable('#header-menu-notifications', topHeight) @@ -119,11 +114,8 @@ function setTopStyle(selector, topValue) { * @param topValue */ function setMarginTopAndHeight(selector, topValue) { - /* eslint-disable no-console */ - console.log('hello1') const element = document.querySelector(selector) if (element) { - console.log('hello2') element.style.cssText += `margin-top: ${topValue} !important;` const heightValue = `calc(100% - env(safe-area-inset-bottom) - ${topValue} - var(--body-container-margin)) !important` element.style.cssText += `height: ${heightValue};` -- GitLab