From ed553ee2f44884376978b246fc8aa9834653b015 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 8 Jul 2024 18:35:37 +0530 Subject: [PATCH 1/4] add banner --- src/email-recovery.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/email-recovery.js b/src/email-recovery.js index e28a1c9..34a2c4b 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -17,17 +17,25 @@ document.addEventListener('DOMContentLoaded', function() { newDiv.appendChild(link) insertIntoDOM(newDiv) // Measure the height after the element is inserted into the DOM - const banner = document.getElementById('recovery-email-banner') - if (banner) { - const bannerHeight = banner.clientHeight + 'px' - const topHeight = (banner.clientHeight + 50) + 'px' - setTopStyle('#header', bannerHeight) - setMarginTopAndHeight('#content', topHeight) - setMarginTopAndHeight('#content-vue', topHeight) - setTopStyleWhenElementAvailable('#header-menu-user-menu', topHeight) - setTopStyleWhenElementAvailable('#header-menu-notifications', topHeight) - setTopStyle('#header-menu-unified-search', topHeight) - banner.style.height = bannerHeight + if (banner && (content || contentVue)) { + const bannerHeight = banner.clientHeight + 'px'; + const topHeight = (banner.clientHeight + 50) + 'px'; + + setTopStyle('#header', bannerHeight); + + if (content) { + setMarginTopAndHeight('#content', topHeight); + } + + if (contentVue) { + setMarginTopAndHeight('#content-vue', topHeight); + } + + setTopStyleWhenElementAvailable('#header-menu-user-menu', topHeight); + setTopStyleWhenElementAvailable('#header-menu-notifications', topHeight); + setTopStyle('#header-menu-unified-search', topHeight); + + banner.style.height = bannerHeight; } }) -- GitLab From 913ceebedea7ddca767ce0c4dd96e5809223e6c8 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 8 Jul 2024 18:39:35 +0530 Subject: [PATCH 2/4] declare content and content vue --- src/email-recovery.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/email-recovery.js b/src/email-recovery.js index 34a2c4b..412a4a6 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -16,26 +16,30 @@ document.addEventListener('DOMContentLoaded', function() { newDiv.appendChild(contentDiv) newDiv.appendChild(link) insertIntoDOM(newDiv) + + const banner = document.getElementById('recovery-email-banner') + const content = document.getElementById('content') + const contentVue = document.getElementById('content-vue') // Measure the height after the element is inserted into the DOM if (banner && (content || contentVue)) { - const bannerHeight = banner.clientHeight + 'px'; - const topHeight = (banner.clientHeight + 50) + 'px'; + const bannerHeight = banner.clientHeight + 'px' + const topHeight = (banner.clientHeight + 50) + 'px' - setTopStyle('#header', bannerHeight); + setTopStyle('#header', bannerHeight) if (content) { - setMarginTopAndHeight('#content', topHeight); + setMarginTopAndHeight('#content', topHeight) } if (contentVue) { - setMarginTopAndHeight('#content-vue', topHeight); + setMarginTopAndHeight('#content-vue', topHeight) } - setTopStyleWhenElementAvailable('#header-menu-user-menu', topHeight); - setTopStyleWhenElementAvailable('#header-menu-notifications', topHeight); - setTopStyle('#header-menu-unified-search', topHeight); + setTopStyleWhenElementAvailable('#header-menu-user-menu', topHeight) + setTopStyleWhenElementAvailable('#header-menu-notifications', topHeight) + setTopStyle('#header-menu-unified-search', topHeight) - banner.style.height = bannerHeight; + banner.style.height = bannerHeight } }) -- GitLab From 0660c51f905d194ee50af40ef1f7125968d3bf0c Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 8 Jul 2024 18:47:55 +0530 Subject: [PATCH 3/4] declare content and content vue --- src/email-recovery.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/email-recovery.js b/src/email-recovery.js index 412a4a6..89dbbf1 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -23,22 +23,17 @@ document.addEventListener('DOMContentLoaded', function() { // Measure the height after the element is inserted into the DOM if (banner && (content || contentVue)) { const bannerHeight = banner.clientHeight + 'px' - const topHeight = (banner.clientHeight + 50) + 'px' - + const topHeight = (banner.clientHeight + 50) + 'px' setTopStyle('#header', bannerHeight) - if (content) { setMarginTopAndHeight('#content', topHeight) } - if (contentVue) { setMarginTopAndHeight('#content-vue', topHeight) } - setTopStyleWhenElementAvailable('#header-menu-user-menu', topHeight) setTopStyleWhenElementAvailable('#header-menu-notifications', topHeight) setTopStyle('#header-menu-unified-search', topHeight) - banner.style.height = bannerHeight } -- GitLab From 9e64f3352b444a69924789b65272cd8bcff2c61f Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 8 Jul 2024 18:50:50 +0530 Subject: [PATCH 4/4] lint fix --- src/email-recovery.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/email-recovery.js b/src/email-recovery.js index 89dbbf1..f5c80e1 100644 --- a/src/email-recovery.js +++ b/src/email-recovery.js @@ -23,7 +23,7 @@ document.addEventListener('DOMContentLoaded', function() { // Measure the height after the element is inserted into the DOM if (banner && (content || contentVue)) { const bannerHeight = banner.clientHeight + 'px' - const topHeight = (banner.clientHeight + 50) + 'px' + const topHeight = (banner.clientHeight + 50) + 'px' setTopStyle('#header', bannerHeight) if (content) { setMarginTopAndHeight('#content', topHeight) -- GitLab