From e8f71e7e3d660afe316079d1ba4c86d9309dada2 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 14:39:51 -0700 Subject: [PATCH 01/16] Business banner --- .../BeforeTemplateRenderedListener.php | 10 +- scss/business-banner.scss | 56 ++++++ src/business-banner.js | 171 ++++++++++++++++++ webpack.config.js | 3 +- 4 files changed, 237 insertions(+), 3 deletions(-) create mode 100644 scss/business-banner.scss create mode 100644 src/business-banner.js diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index adece9c3..f814d25a 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -13,7 +13,7 @@ use OCP\IRequest; use OCP\ISession; use OCP\IUserSession; use OCP\Util; - +use OCP\AppFramework\Http\TemplateResponse; class BeforeTemplateRenderedListener implements IEventListener { private $userSession; private $request; @@ -49,7 +49,13 @@ class BeforeTemplateRenderedListener implements IEventListener { if (strpos($pathInfo, '/apps/ecloud-accounts/accounts') !== false) { $this->util->addStyle($this->appName, $this->appName . '-userregistration'); } - + if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $event->isLoggedIn() && !empty($this->userId)) { + // $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); + // if ($recoveryEmail === '') { + $this->util->addStyle($this->appName, 'business-banner'); + $this->util->addScript($this->appName, $this->appName . '-business-banner'); + // } + } } diff --git a/scss/business-banner.scss b/scss/business-banner.scss new file mode 100644 index 00000000..aa010b6b --- /dev/null +++ b/scss/business-banner.scss @@ -0,0 +1,56 @@ +.recovery-email-banner { + display: inline-flex; + position: absolute; + top: 0px; + width: 100%; + min-height: 50px; + box-sizing: border-box; + justify-content: center; + align-items: center; + background: #333333; + color: #ffffff; + font-size: 16px; + font-weight: 400; + line-height: 24px; + padding: 16px 6%; + #recovery-email-banner-container{ + display:inline-flex; + img { + padding-right:10px; + align-self: start; + } + p{ + margin: 0 auto; + } + } + + a { + color: #ffffff; + padding-left: 24px; + text-decoration: underline; + font-size: 16px; + font-weight: 600; + } + +} + +@media only screen and (max-width: 768px) { + .recovery-email-banner { + display: block; + a{ + padding: 8px 0 0 30px; + } + } +} +[data-object-type="email-recovery-important"] a.external { + background-color: var(--color-primary-element); + color: var(--color-primary-element-text); + text-decoration: none; + display: block; + text-align: center; + padding: 10px 12px; + border-radius: 30px; + font-size: 12px; + font-weight: bold; + width: fit-content; +} diff --git a/src/business-banner.js b/src/business-banner.js new file mode 100644 index 00000000..a777e3f9 --- /dev/null +++ b/src/business-banner.js @@ -0,0 +1,171 @@ +import { generateUrl } from '@nextcloud/router' +import { loadState } from '@nextcloud/initial-state' + +const unverifiedRecoveryEmail = loadState('ecloud-accounts', 'unverifiedRecoveryEmail') +const APPLICATION_NAME = 'ecloud-accounts' +document.addEventListener('DOMContentLoaded', function() { + const newDiv = createNewDiv('business-banner') + const contentDiv = document.createElement('div') + contentDiv.id = 'business-banner-container' + const img = createImageElement(APPLICATION_NAME) + const textNode = createTextNode(APPLICATION_NAME) + const link = createLinkElement(APPLICATION_NAME) + + contentDiv.appendChild(img) + contentDiv.appendChild(textNode) + newDiv.appendChild(contentDiv) + newDiv.appendChild(link) + insertIntoDOM(newDiv) + // Measure the height after the element is inserted into the DOM + const banner = document.getElementById('business-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 + } + +}) + +/** + * Sets the 'top' style to an element once it becomes available in the DOM. + * + * @param {string} selector - The CSS selector for the element. + * @param {string} topValue - The value to be set for the 'top' property. + */ + +/** + * + * @param selector + * @param topValue + */ +function setTopStyleWhenElementAvailable(selector, topValue) { + // Function to check each node and apply style if it matches the selector + /** + * + * @param node + */ + function checkAndApplyStyle(node) { + if (node.nodeType === Node.ELEMENT_NODE) { + if (node.matches(selector)) { + node.style.top = topValue + } + + // Check all child nodes + node.querySelectorAll(selector).forEach(childNode => { + childNode.style.top = topValue + }) + } + } + + // Set up a MutationObserver to watch for added nodes + const observer = new MutationObserver(mutations => { + mutations.forEach(mutation => { + mutation.addedNodes.forEach(checkAndApplyStyle) + }) + }) + + // Start observing the document body for added nodes + observer.observe(document.body, { childList: true, subtree: true }) +} + +/** + * Sets the 'top' style property of an element. + * The element is selected based on the provided CSS selector. + * + * @param {string} selector + * @param {string} topValue + */ +function setTopStyle(selector, topValue) { + const element = document.querySelector(selector) + if (element) { + element.style.top = topValue + } +} + +/** + * Apply a margin-top style with !important and calculate a new height for the element. + * + * @param {string} selector - The CSS selector for the element. + * @param {string} topValue - The value for the margin-top property. + */ + +/** + * + * @param selector + * @param topValue + */ +function setMarginTopAndHeight(selector, topValue) { + const element = document.querySelector(selector) + if (element) { + 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};` + } +} +/** + * + * @param className + */ +function createNewDiv(className) { + const div = document.createElement('div') + div.className = className + div.id = className + return div +} + +/** + * + * @param appName + */ +function createImageElement(appName) { + const img = document.createElement('img') + img.src = generateUrl('/custom_apps/' + appName + '/img/warning.svg') + return img +} + +/** + * + * @param appName + */ +function createTextNode(appName) { + const p = document.createElement('p') + let labelText = t(appName, 'Please set your recovery email address to use your email account without restrictions.') + if (unverifiedRecoveryEmail !== '') { + labelText = t(appName, 'Please verify your recovery email address to fully enjoy your murena.io account.') + } + const text = document.createTextNode(labelText) + p.appendChild(text) + return p +} + +/** + * + * @param appName + */ +function createLinkElement(appName) { + const link = document.createElement('a') + let labelText = t(appName, 'SET RECOVERY EMAIL NOW') + if (unverifiedRecoveryEmail !== '') { + labelText = t(appName, 'VERIFY RECOVERY EMAIL NOW') + } + link.textContent = labelText + link.href = OC.getRootPath() + '/settings/user/security#recovery-email-div' + link.style.display = 'block' + return link +} + +/** + * + * @param element + */ +function insertIntoDOM(element) { + const targetElement = document.getElementById('header') + const parentElement = targetElement.parentNode + parentElement.insertBefore(element, targetElement) +} diff --git a/webpack.config.js b/webpack.config.js index b6eaacba..e4d82caa 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,6 +9,7 @@ module.exports = { 'delete-shop-account-setting': path.join(__dirname, 'src/delete-shop-account-setting.js'), 'delete-account-listeners': path.join(__dirname, 'src/delete-account-listeners.js'), 'beta-user-setting': path.join(__dirname, 'src/beta-user-setting.js'), - 'signup': path.join(__dirname, 'src/signup.js') + 'signup': path.join(__dirname, 'src/signup.js'), + 'business-banner': path.join(__dirname, 'src/business-banner.js'), }, } -- GitLab From a2724b5204c136159672fd9abd181518d0ac42a7 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 14:41:14 -0700 Subject: [PATCH 02/16] changes --- lib/Listeners/BeforeTemplateRenderedListener.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index f814d25a..7462d089 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -6,6 +6,7 @@ namespace OCA\EcloudAccounts\Listeners; use OCP\App\IAppManager; use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; +use OCP\AppFramework\Http\TemplateResponse; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\IConfig; @@ -13,7 +14,7 @@ use OCP\IRequest; use OCP\ISession; use OCP\IUserSession; use OCP\Util; -use OCP\AppFramework\Http\TemplateResponse; + class BeforeTemplateRenderedListener implements IEventListener { private $userSession; private $request; @@ -52,8 +53,8 @@ class BeforeTemplateRenderedListener implements IEventListener { if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $event->isLoggedIn() && !empty($this->userId)) { // $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); // if ($recoveryEmail === '') { - $this->util->addStyle($this->appName, 'business-banner'); - $this->util->addScript($this->appName, $this->appName . '-business-banner'); + $this->util->addStyle($this->appName, 'business-banner'); + $this->util->addScript($this->appName, $this->appName . '-business-banner'); // } } } -- GitLab From 678cac2d0af43bb8328f530ae95cc6e84e23fd7c Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 14:43:41 -0700 Subject: [PATCH 03/16] changes --- lib/Listeners/BeforeTemplateRenderedListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index 7462d089..2d1100ac 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -50,7 +50,7 @@ class BeforeTemplateRenderedListener implements IEventListener { if (strpos($pathInfo, '/apps/ecloud-accounts/accounts') !== false) { $this->util->addStyle($this->appName, $this->appName . '-userregistration'); } - if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $event->isLoggedIn() && !empty($this->userId)) { + if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $event->isLoggedIn()) { // $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); // if ($recoveryEmail === '') { $this->util->addStyle($this->appName, 'business-banner'); -- GitLab From a842f11e12776e23072c83e623ddc473261339b2 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 14:46:18 -0700 Subject: [PATCH 04/16] changes --- scss/business-banner.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scss/business-banner.scss b/scss/business-banner.scss index aa010b6b..f3a258bf 100644 --- a/scss/business-banner.scss +++ b/scss/business-banner.scss @@ -1,4 +1,4 @@ -.recovery-email-banner { +.ecloud-accounts-banner { display: inline-flex; position: absolute; top: 0px; @@ -13,7 +13,7 @@ font-weight: 400; line-height: 24px; padding: 16px 6%; - #recovery-email-banner-container{ + #ecloud-accounts-banner-container{ display:inline-flex; img { padding-right:10px; @@ -35,14 +35,14 @@ } @media only screen and (max-width: 768px) { - .recovery-email-banner { + .ecloud-accounts-banner { display: block; a{ padding: 8px 0 0 30px; } } } -[data-object-type="email-recovery-important"] a.external { +[data-object-type="ecloud-accounts-important"] a.external { background-color: var(--color-primary-element); color: var(--color-primary-element-text); text-decoration: none; -- GitLab From 60b123aa78dc37802d28164fd80dba9ace71d085 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 14:57:39 -0700 Subject: [PATCH 05/16] added crowdcube.png --- img/crowdcube.png | Bin 0 -> 8311 bytes .../BeforeTemplateRenderedListener.php | 11 ++++++++-- src/business-banner.js | 19 ++++++++---------- 3 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 img/crowdcube.png diff --git a/img/crowdcube.png b/img/crowdcube.png new file mode 100644 index 0000000000000000000000000000000000000000..a37524efef71ff6f93cdd28b3418f68ef48ef1ce GIT binary patch literal 8311 zcmeAS@N?(olHy`uVBq!ia0y~yVANq?UVec>yB>GgyR?fnfm?OqNk+0W*xv5Dro} z*REj>1B3iSPZ!6K3dXmw?0aNguiAfC)!3`KP)&tpf)LXsM>`G$(`8DWNefqO6rA9} zuUn!jlBp%eq~Y4AQZi9XRWf|rM8e_l0uR~(t`Gc1(%$EN$!?36fnHtD&cYLB*V%RTAwuQbd6Z3WxD^MVRp)H~ zXZj^RBq-dBoHm)&q371xT({{dF590@l)tad|1K*{{gc^|!@Ljv8H8&~3$9L7efBkz zM@2csF_MQXceS@rfhUvR$rlsb9!Ts|QCN6bVWPUCT;7V8TYi<_@J&7}$b46XxwC;; zieE2NZikA{(lT%9^DmF?jd?O@S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VIWw| z;+@N{>AN9ET;O41_6-To9UE?HKn)ULd)LtQvgAj^S(cBQdsi>ZYf9Zc?Tymv2itCB zs4V_?`_!}J$sh}lIB2tNn9kL<+htwDkMBOp5t%a*mge7krD`u%d1Jlejr9sQv;%GR z`2BJO=YYNO;;+OE=0{%??)|i0_7obUh MPgg&ebxsLQ06?$+6#xJL literal 0 HcmV?d00001 diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index 2d1100ac..1ccf784b 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -7,6 +7,7 @@ namespace OCA\EcloudAccounts\Listeners; use OCP\App\IAppManager; use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; use OCP\AppFramework\Http\TemplateResponse; +use OCP\AppFramework\Services\IInitialState; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\IConfig; @@ -27,8 +28,9 @@ class BeforeTemplateRenderedListener implements IEventListener { private const SNAPPYMAIL_APP_ID = 'snappymail'; private const SNAPPYMAIL_URL = '/apps/snappymail/'; private const SNAPPYMAIL_AUTOLOGIN_PWD = '1'; - - public function __construct($appName, IUserSession $userSession, IRequest $request, ISession $session, IConfig $config, IAppManager $appManager, Util $util) { + private IInitialState $initialState; + private $userId; + public function __construct($appName, IUserSession $userSession, IRequest $request, ISession $session, IConfig $config, IAppManager $appManager, Util $util, $userId, IInitialState $initialState) { $this->appName = $appName; $this->userSession = $userSession; $this->request = $request; @@ -36,6 +38,8 @@ class BeforeTemplateRenderedListener implements IEventListener { $this->config = $config; $this->appManager = $appManager; $this->util = $util; + $this->initialState = $initialState; + $this->userId = $userId; } public function handle(Event $event): void { @@ -53,6 +57,9 @@ class BeforeTemplateRenderedListener implements IEventListener { if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $event->isLoggedIn()) { // $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); // if ($recoveryEmail === '') { + // $unverifiedRecoveryEmail = $this->recoveryEmailService->getUnverifiedRecoveryEmail($this->userId); + $userLocation = 'USA'; + $this->initialState->provideInitialState('userLocation', $userLocation); $this->util->addStyle($this->appName, 'business-banner'); $this->util->addScript($this->appName, $this->appName . '-business-banner'); // } diff --git a/src/business-banner.js b/src/business-banner.js index a777e3f9..080cccce 100644 --- a/src/business-banner.js +++ b/src/business-banner.js @@ -1,7 +1,7 @@ import { generateUrl } from '@nextcloud/router' import { loadState } from '@nextcloud/initial-state' -const unverifiedRecoveryEmail = loadState('ecloud-accounts', 'unverifiedRecoveryEmail') +const userLocation = loadState('ecloud-accounts', 'userLocation') const APPLICATION_NAME = 'ecloud-accounts' document.addEventListener('DOMContentLoaded', function() { const newDiv = createNewDiv('business-banner') @@ -125,7 +125,7 @@ function createNewDiv(className) { */ function createImageElement(appName) { const img = document.createElement('img') - img.src = generateUrl('/custom_apps/' + appName + '/img/warning.svg') + img.src = generateUrl('/custom_apps/' + appName + '/img/crowdcube.png') return img } @@ -135,10 +135,10 @@ function createImageElement(appName) { */ function createTextNode(appName) { const p = document.createElement('p') - let labelText = t(appName, 'Please set your recovery email address to use your email account without restrictions.') - if (unverifiedRecoveryEmail !== '') { - labelText = t(appName, 'Please verify your recovery email address to fully enjoy your murena.io account.') - } + let labelText = t(appName, 'Own a Part of Murena!') + // if (userLocation !== 'USA') { + // labelText = t(appName, 'Please verify your recovery email address to fully enjoy your murena.io account.') + // } const text = document.createTextNode(labelText) p.appendChild(text) return p @@ -150,12 +150,9 @@ function createTextNode(appName) { */ function createLinkElement(appName) { const link = document.createElement('a') - let labelText = t(appName, 'SET RECOVERY EMAIL NOW') - if (unverifiedRecoveryEmail !== '') { - labelText = t(appName, 'VERIFY RECOVERY EMAIL NOW') - } + let labelText = t(appName, 'LEARN MORE') link.textContent = labelText - link.href = OC.getRootPath() + '/settings/user/security#recovery-email-div' + link.href = 'https://murena.com/investors/' link.style.display = 'block' return link } -- GitLab From 58b4333dddb075a050f622e44c59e41ca58a9f56 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 14:59:55 -0700 Subject: [PATCH 06/16] lint fix --- src/business-banner.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/business-banner.js b/src/business-banner.js index 080cccce..52894167 100644 --- a/src/business-banner.js +++ b/src/business-banner.js @@ -1,7 +1,7 @@ import { generateUrl } from '@nextcloud/router' -import { loadState } from '@nextcloud/initial-state' +// import { loadState } from '@nextcloud/initial-state' -const userLocation = loadState('ecloud-accounts', 'userLocation') +// const userLocation = loadState('ecloud-accounts', 'userLocation') const APPLICATION_NAME = 'ecloud-accounts' document.addEventListener('DOMContentLoaded', function() { const newDiv = createNewDiv('business-banner') @@ -135,10 +135,7 @@ function createImageElement(appName) { */ function createTextNode(appName) { const p = document.createElement('p') - let labelText = t(appName, 'Own a Part of Murena!') - // if (userLocation !== 'USA') { - // labelText = t(appName, 'Please verify your recovery email address to fully enjoy your murena.io account.') - // } + const labelText = t(appName, 'Own a Part of Murena!') const text = document.createTextNode(labelText) p.appendChild(text) return p @@ -150,7 +147,7 @@ function createTextNode(appName) { */ function createLinkElement(appName) { const link = document.createElement('a') - let labelText = t(appName, 'LEARN MORE') + const labelText = t(appName, 'LEARN MORE') link.textContent = labelText link.href = 'https://murena.com/investors/' link.style.display = 'block' -- GitLab From 4d42805b3633442d4e3c90f95f432a8ff1165403 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 15:03:26 -0700 Subject: [PATCH 07/16] lint fix --- img/crowdcube.png | Bin 8311 -> 2910 bytes scss/business-banner.scss | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/img/crowdcube.png b/img/crowdcube.png index a37524efef71ff6f93cdd28b3418f68ef48ef1ce..6f15ba707528bd6658dfad4098f714982abc6fc7 100644 GIT binary patch literal 2910 zcmeAS@N?(olHy`uVBq!ia0y~yVANq?U1A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|%{%TVYT3X36s*}9{=v0imA-ABosrYtC9mbTy=Og^H79Sf*oELS@8>P^ zizizg{&lIfsWxE=yY=~d2Wl?YtU45Z-MeTuAG6@4qBCbtzF}^xa_M?klD+VYWaokmV24}`@ z@12uP74KbK+TJGjt$m%>5!1cTf7X4LT^XLV(bn@xf=AthhFc3S)n%QVG;z}u9fe|t zEo{55Cs`$dCwPMmCY<0k@-Aa(^t$x@aL|<2Q>LHHI1YH&zvB!MCNp0M zX@664-!Owy_4;ImsKo`pG%pK+hTWCetXP>l1N!c9E>bwtRT;o3*4>zKx9zapPc1`r zh#kxZ6Hfe|@a9<4HwVU5%sbX49oRPa?7`gF&il{1ypOF04fhK&mnJ``JW*_Yp!09% zBC$O()7FN})Gcp(budM3L%Ms11PEqWv8|iM&6DcoNpX18aoRM&oZSqGWp><1x9bbvGYeZ|wfo36;*tiTPoM`6QVIWw| z;+@N{>AN9ET;O41_6-To9UE?HKn)ULd)LtQvgAj^S(cBQdsi>ZYf9Zc?Tymv2itCB zs4V_?`_!}J$sh}lIB2tNn9kL<+htwDkMBOp5t%a*mge7krD`u%d1Jlejr9sQv;%GR z`2BJO=YYNO;;+OE=0{%??)|i0_7obUh MPgg&ebxsLQ06?$+6#xJL diff --git a/scss/business-banner.scss b/scss/business-banner.scss index f3a258bf..24b78cb7 100644 --- a/scss/business-banner.scss +++ b/scss/business-banner.scss @@ -1,4 +1,4 @@ -.ecloud-accounts-banner { +.business-banner { display: inline-flex; position: absolute; top: 0px; @@ -13,7 +13,7 @@ font-weight: 400; line-height: 24px; padding: 16px 6%; - #ecloud-accounts-banner-container{ + #business-banner-container{ display:inline-flex; img { padding-right:10px; @@ -35,14 +35,14 @@ } @media only screen and (max-width: 768px) { - .ecloud-accounts-banner { + .business-banner { display: block; a{ padding: 8px 0 0 30px; } } } -[data-object-type="ecloud-accounts-important"] a.external { +[data-object-type="business-banner-important"] a.external { background-color: var(--color-primary-element); color: var(--color-primary-element-text); text-decoration: none; -- GitLab From 1538eb6fb2df2bcc01c6d25ba313c6d4b911e558 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 15:05:56 -0700 Subject: [PATCH 08/16] lint fix --- scss/business-banner.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scss/business-banner.scss b/scss/business-banner.scss index 24b78cb7..4ec7c6fc 100644 --- a/scss/business-banner.scss +++ b/scss/business-banner.scss @@ -18,6 +18,8 @@ img { padding-right:10px; align-self: start; + height: 25px; + width: auto; } p{ margin: 0 auto; -- GitLab From d5b4f6b0c8b8fb0f93690eafbcbede7bf5a45594 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 15:10:35 -0700 Subject: [PATCH 09/16] lint fix --- src/business-banner.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/business-banner.js b/src/business-banner.js index 52894167..bdb07cec 100644 --- a/src/business-banner.js +++ b/src/business-banner.js @@ -10,11 +10,13 @@ document.addEventListener('DOMContentLoaded', function() { const img = createImageElement(APPLICATION_NAME) const textNode = createTextNode(APPLICATION_NAME) const link = createLinkElement(APPLICATION_NAME) + const closeButton = createCloseButton() contentDiv.appendChild(img) contentDiv.appendChild(textNode) newDiv.appendChild(contentDiv) newDiv.appendChild(link) + newDiv.appendChild(closeButton) insertIntoDOM(newDiv) // Measure the height after the element is inserted into the DOM const banner = document.getElementById('business-banner') @@ -153,6 +155,17 @@ function createLinkElement(appName) { link.style.display = 'block' return link } +/** + * + * @param appName + */ +function createCloseButton() { + const span = document.createElement('span') + const labelText = 'X' + span.textContent = labelText + span.style.display = 'block' + return span +} /** * -- GitLab From 1c975c4702e6c34faee5539763dfb02420a8da55 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 15:13:49 -0700 Subject: [PATCH 10/16] added spam css --- scss/business-banner.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scss/business-banner.scss b/scss/business-banner.scss index 4ec7c6fc..75314a05 100644 --- a/scss/business-banner.scss +++ b/scss/business-banner.scss @@ -24,6 +24,11 @@ p{ margin: 0 auto; } + span { + position: absolute; + right: 20px; + cursor: pointer; + } } a { -- GitLab From d546c3bdbc6cae840b4789a9f539c252334bfe80 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 15:17:53 -0700 Subject: [PATCH 11/16] added localstorage to close it permanent --- src/business-banner.js | 61 +++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/src/business-banner.js b/src/business-banner.js index bdb07cec..829b11d2 100644 --- a/src/business-banner.js +++ b/src/business-banner.js @@ -4,34 +4,35 @@ import { generateUrl } from '@nextcloud/router' // const userLocation = loadState('ecloud-accounts', 'userLocation') const APPLICATION_NAME = 'ecloud-accounts' document.addEventListener('DOMContentLoaded', function() { - const newDiv = createNewDiv('business-banner') - const contentDiv = document.createElement('div') - contentDiv.id = 'business-banner-container' - const img = createImageElement(APPLICATION_NAME) - const textNode = createTextNode(APPLICATION_NAME) - const link = createLinkElement(APPLICATION_NAME) - const closeButton = createCloseButton() + if (!localStorage.getItem('bannerClosed')) { + const newDiv = createNewDiv('business-banner') + const contentDiv = document.createElement('div') + contentDiv.id = 'business-banner-container' + const img = createImageElement(APPLICATION_NAME) + const textNode = createTextNode(APPLICATION_NAME) + const link = createLinkElement(APPLICATION_NAME) + const closeButton = createCloseButton(newDiv) - contentDiv.appendChild(img) - contentDiv.appendChild(textNode) - newDiv.appendChild(contentDiv) - newDiv.appendChild(link) - newDiv.appendChild(closeButton) - insertIntoDOM(newDiv) - // Measure the height after the element is inserted into the DOM - const banner = document.getElementById('business-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 + contentDiv.appendChild(img) + contentDiv.appendChild(textNode) + newDiv.appendChild(contentDiv) + newDiv.appendChild(link) + newDiv.appendChild(closeButton) + insertIntoDOM(newDiv) + // Measure the height after the element is inserted into the DOM + const banner = document.getElementById('business-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 + } } - }) /** @@ -158,12 +159,18 @@ function createLinkElement(appName) { /** * * @param appName + * @param banner */ -function createCloseButton() { +function createCloseButton(banner) { const span = document.createElement('span') const labelText = 'X' span.textContent = labelText span.style.display = 'block' + span.style.cursor = 'pointer' + span.addEventListener('click', function() { + banner.style.display = 'none' + localStorage.setItem('bannerClosed', 'true') + }) return span } -- GitLab From 2100bd66af23d15912f7d5deb669ead25f1a8fce Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 15:22:57 -0700 Subject: [PATCH 12/16] added translations --- l10n/de.js | 3 ++- l10n/de.json | 3 ++- l10n/en.js | 3 ++- l10n/en.json | 3 ++- l10n/es.js | 3 ++- l10n/es.json | 3 ++- l10n/fr.js | 3 ++- l10n/fr.json | 3 ++- l10n/it.js | 3 ++- l10n/it.json | 3 ++- 10 files changed, 20 insertions(+), 10 deletions(-) diff --git a/l10n/de.js b/l10n/de.js index 26bd31c0..a5dcd6f3 100644 --- a/l10n/de.js +++ b/l10n/de.js @@ -85,6 +85,7 @@ OC.L10N.register( "Captcha is not verified!": "Captcha wird nicht überprüft!", "A server-side error occurred while processing your request! Please try again later.": "Ein serverseitiger Fehler ist bei der Bearbeitung Ihrer Anfrage aufgetreten! Bitte versuchen Sie es später noch einmal.", "An error occurred while creating your account!": "Beim Anlegen Ihres Kontos ist ein Fehler aufgetreten!", - "The domain of this email address is blacklisted. Please provide another recovery address.": "Die Domäne dieser E-Mailadresse ist auf der Sperrliste. Bitte geben Sie eine andere E-Mailadresse an." + "The domain of this email address is blacklisted. Please provide another recovery address.": "Die Domäne dieser E-Mailadresse ist auf der Sperrliste. Bitte geben Sie eine andere E-Mailadresse an.", + "Own a Part of Murena!": "Besitzen Sie einen Teil von Murena!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/de.json b/l10n/de.json index 581f0a74..b2e6e195 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -83,7 +83,8 @@ "Captcha is not verified!": "Captcha wird nicht überprüft!", "A server-side error occurred while processing your request! Please try again later.": "Ein serverseitiger Fehler ist bei der Bearbeitung Ihrer Anfrage aufgetreten! Bitte versuchen Sie es später noch einmal.", "An error occurred while creating your account!": "Beim Anlegen Ihres Kontos ist ein Fehler aufgetreten!", - "The domain of this email address is blacklisted. Please provide another recovery address.": "Die Domäne dieser E-Mailadresse ist auf der Sperrliste. Bitte geben Sie eine andere E-Mailadresse an." + "The domain of this email address is blacklisted. Please provide another recovery address.": "Die Domäne dieser E-Mailadresse ist auf der Sperrliste. Bitte geben Sie eine andere E-Mailadresse an.", + "Own a Part of Murena!": "Besitzen Sie einen Teil von Murena!" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/en.js b/l10n/en.js index b25bf722..4136a500 100644 --- a/l10n/en.js +++ b/l10n/en.js @@ -89,6 +89,7 @@ OC.L10N.register( "Captcha is not verified!": "Captcha is not verified!", "A server-side error occurred while processing your request! Please try again later.": "A server-side error occurred while processing your request! Please try again later.", "An error occurred while creating your account!": "An error occurred while creating your account!", - "The domain of this email address is blacklisted. Please provide another recovery address.": "The domain of this email address is blacklisted. Please provide another recovery address." + "The domain of this email address is blacklisted. Please provide another recovery address.": "The domain of this email address is blacklisted. Please provide another recovery address.", + "Own a Part of Murena!": "Own a Part of Murena!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/en.json b/l10n/en.json index be378a0a..f4f22a4f 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -85,7 +85,8 @@ "Captcha is not verified!": "Captcha is not verified!", "A server-side error occurred while processing your request! Please try again later.": "A server-side error occurred while processing your request! Please try again later.", "An error occurred while creating your account!": "An error occurred while creating your account!", - "The domain of this email address is blacklisted. Please provide another recovery address.": "The domain of this email address is blacklisted. Please provide another recovery address." + "The domain of this email address is blacklisted. Please provide another recovery address.": "The domain of this email address is blacklisted. Please provide another recovery address.", + "Own a Part of Murena!": "Own a Part of Murena!" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/es.js b/l10n/es.js index 19fa33c7..940e8f2a 100644 --- a/l10n/es.js +++ b/l10n/es.js @@ -87,6 +87,7 @@ OC.L10N.register( "Captcha is not verified!": "¡Captcha no está verificado!", "A server-side error occurred while processing your request! Please try again later.": "Hubo un error en el servidor al procesar tu solicitud. Por favor, inténtalo más tarde.", "An error occurred while creating your account!": "¡Hubo un error creando tu cuenta!", - "The domain of this email address is blacklisted. Please provide another recovery address.": "El dominio de esta dirección de correo electrónico está en lista negra. Por favor, proporciona otra dirección de recuperación." + "The domain of this email address is blacklisted. Please provide another recovery address.": "El dominio de esta dirección de correo electrónico está en lista negra. Por favor, proporciona otra dirección de recuperación.", + "Own a Part of Murena!": "¡Sea dueño de una parte de Murena!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/es.json b/l10n/es.json index 867f150d..a935c2d6 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -86,7 +86,8 @@ "Captcha is not verified!": "¡Captcha no está verificado!", "A server-side error occurred while processing your request! Please try again later.": "Hubo un error en el servidor al procesar tu solicitud. Por favor, inténtalo más tarde.", "An error occurred while creating your account!": "¡Hubo un error creando tu cuenta!", - "The domain of this email address is blacklisted. Please provide another recovery address.": "El dominio de esta dirección de correo electrónico está en lista negra. Por favor, proporciona otra dirección de recuperación." + "The domain of this email address is blacklisted. Please provide another recovery address.": "El dominio de esta dirección de correo electrónico está en lista negra. Por favor, proporciona otra dirección de recuperación.", + "Own a Part of Murena!": "¡Sea dueño de una parte de Murena!" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/fr.js b/l10n/fr.js index 6efaeeca..36f4bb42 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -86,6 +86,7 @@ OC.L10N.register( "Captcha is not verified!": "Captcha n'est pas vérifié !", "A server-side error occurred while processing your request! Please try again later.": "Erreur du serveur dans la gestion de votre demande ! Merci d'essayer ultérieurement.", "An error occurred while creating your account!": "Une erreur s'est produite lors de la création de votre compte!", - "The domain of this email address is blacklisted. Please provide another recovery address.": "Le domain de cette adresse e-mail est sur liste noire. Merci de bien vouloir fournir une autre adresse de récupération." + "The domain of this email address is blacklisted. Please provide another recovery address.": "Le domain de cette adresse e-mail est sur liste noire. Merci de bien vouloir fournir une autre adresse de récupération.", + "Own a Part of Murena!": "Une partie de Murena vous appartient !" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/fr.json b/l10n/fr.json index 19facc30..a97f62b9 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -85,7 +85,8 @@ "Captcha is not verified!": "Captcha n'est pas vérifié !", "A server-side error occurred while processing your request! Please try again later.": "Erreur du serveur dans la gestion de votre demande ! Merci d'essayer ultérieurement.", "An error occurred while creating your account!": "Une erreur s'est produite lors de la création de votre compte!", - "The domain of this email address is blacklisted. Please provide another recovery address.": "Le domain de cette adresse e-mail est sur liste noire. Merci de bien vouloir fournir une autre adresse de récupération." + "The domain of this email address is blacklisted. Please provide another recovery address.": "Le domain de cette adresse e-mail est sur liste noire. Merci de bien vouloir fournir une autre adresse de récupération.", + "Own a Part of Murena!": "Une partie de Murena vous appartient !" }, "pluralForm": "nplurals=2; plural=(n != 1);" } diff --git a/l10n/it.js b/l10n/it.js index 84c211cd..cafd5717 100644 --- a/l10n/it.js +++ b/l10n/it.js @@ -86,6 +86,7 @@ OC.L10N.register( "Captcha is not verified!": "Il Captcha non è verificato!", "A server-side error occurred while processing your request! Please try again later.": "Si è verificato un errore lato server nel processare la tua richiesta! Ritenta più tardi.", "An error occurred while creating your account!": "Si è verificato un errore nella creazione dell'account!", - "The domain of this email address is blacklisted. Please provide another recovery address.": "Il dominio cui appartiene questo indirizzo e-mail è contenuto in una black list. Inserisci un indirizzo di recovery differente." + "The domain of this email address is blacklisted. Please provide another recovery address.": "Il dominio cui appartiene questo indirizzo e-mail è contenuto in una black list. Inserisci un indirizzo di recovery differente.", + "Own a Part of Murena!": "Possedere una parte di Murena!" }, "nplurals=2; plural=(n != 1);"); diff --git a/l10n/it.json b/l10n/it.json index 2685c394..57299854 100644 --- a/l10n/it.json +++ b/l10n/it.json @@ -81,7 +81,8 @@ "Captcha is not verified!": "Il Captcha non è verificato!", "A server-side error occurred while processing your request! Please try again later.": "Si è verificato un errore lato server nel processare la tua richiesta! Ritenta più tardi.", "An error occurred while creating your account!": "Si è verificato un errore nella creazione dell'account!", - "The domain of this email address is blacklisted. Please provide another recovery address.": "Il dominio cui appartiene questo indirizzo e-mail è contenuto in una black list. Inserisci un indirizzo di recovery differente." + "The domain of this email address is blacklisted. Please provide another recovery address.": "Il dominio cui appartiene questo indirizzo e-mail è contenuto in una black list. Inserisci un indirizzo di recovery differente.", + "Own a Part of Murena!": "Possedere una parte di Murena!" }, "pluralForm": "nplurals=2; plural=(n != 1);" } -- GitLab From cc8ea9c9b085a5ed1ad18ffad5d44caf9016f13c Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 15:26:33 -0700 Subject: [PATCH 13/16] added translations --- scss/business-banner.scss | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scss/business-banner.scss b/scss/business-banner.scss index 75314a05..ee47853c 100644 --- a/scss/business-banner.scss +++ b/scss/business-banner.scss @@ -24,11 +24,6 @@ p{ margin: 0 auto; } - span { - position: absolute; - right: 20px; - cursor: pointer; - } } a { @@ -38,6 +33,12 @@ font-size: 16px; font-weight: 600; } + + span { + position: absolute; + right: 20px; + cursor: pointer; + } } -- GitLab From c02349098a1d59be359d7d6883e4fee6241e0620 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 15:38:51 -0700 Subject: [PATCH 14/16] removed unncessary code --- .../BeforeTemplateRenderedListener.php | 4 ---- src/business-banner.js | 19 +++++++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index 1ccf784b..5023347b 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -55,14 +55,10 @@ class BeforeTemplateRenderedListener implements IEventListener { $this->util->addStyle($this->appName, $this->appName . '-userregistration'); } if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $event->isLoggedIn()) { - // $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); - // if ($recoveryEmail === '') { - // $unverifiedRecoveryEmail = $this->recoveryEmailService->getUnverifiedRecoveryEmail($this->userId); $userLocation = 'USA'; $this->initialState->provideInitialState('userLocation', $userLocation); $this->util->addStyle($this->appName, 'business-banner'); $this->util->addScript($this->appName, $this->appName . '-business-banner'); - // } } } diff --git a/src/business-banner.js b/src/business-banner.js index 829b11d2..29637d8b 100644 --- a/src/business-banner.js +++ b/src/business-banner.js @@ -1,19 +1,21 @@ import { generateUrl } from '@nextcloud/router' -// import { loadState } from '@nextcloud/initial-state' +import { loadState } from '@nextcloud/initial-state' -// const userLocation = loadState('ecloud-accounts', 'userLocation') +const userLocation = loadState('ecloud-accounts', 'userLocation') const APPLICATION_NAME = 'ecloud-accounts' document.addEventListener('DOMContentLoaded', function() { if (!localStorage.getItem('bannerClosed')) { const newDiv = createNewDiv('business-banner') const contentDiv = document.createElement('div') contentDiv.id = 'business-banner-container' - const img = createImageElement(APPLICATION_NAME) + if (userLocation === 'USA') { + const img = createImageElement(APPLICATION_NAME) + contentDiv.appendChild(img) + } const textNode = createTextNode(APPLICATION_NAME) const link = createLinkElement(APPLICATION_NAME) const closeButton = createCloseButton(newDiv) - contentDiv.appendChild(img) contentDiv.appendChild(textNode) newDiv.appendChild(contentDiv) newDiv.appendChild(link) @@ -170,6 +172,15 @@ function createCloseButton(banner) { span.addEventListener('click', function() { banner.style.display = 'none' localStorage.setItem('bannerClosed', 'true') + const bannerHeight = '0' + const topHeight = 'auto' + 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 }) return span } -- GitLab From a333db64c9636e353b3b51e057cdf8070b85d996 Mon Sep 17 00:00:00 2001 From: Fahim Salam Chowdhury Date: Mon, 27 May 2024 10:10:59 +0000 Subject: [PATCH 15/16] Apply 3 suggestion(s) to 2 file(s) Co-authored-by: Fahim Salam Chowdhury --- lib/Listeners/BeforeTemplateRenderedListener.php | 2 ++ scss/business-banner.scss | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index 5023347b..6b4b2d54 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -30,6 +30,7 @@ class BeforeTemplateRenderedListener implements IEventListener { private const SNAPPYMAIL_AUTOLOGIN_PWD = '1'; private IInitialState $initialState; private $userId; + public function __construct($appName, IUserSession $userSession, IRequest $request, ISession $session, IConfig $config, IAppManager $appManager, Util $util, $userId, IInitialState $initialState) { $this->appName = $appName; $this->userSession = $userSession; @@ -54,6 +55,7 @@ class BeforeTemplateRenderedListener implements IEventListener { if (strpos($pathInfo, '/apps/ecloud-accounts/accounts') !== false) { $this->util->addStyle($this->appName, $this->appName . '-userregistration'); } + if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $event->isLoggedIn()) { $userLocation = 'USA'; $this->initialState->provideInitialState('userLocation', $userLocation); diff --git a/scss/business-banner.scss b/scss/business-banner.scss index ee47853c..2b4dbf0a 100644 --- a/scss/business-banner.scss +++ b/scss/business-banner.scss @@ -50,6 +50,7 @@ } } } + [data-object-type="business-banner-important"] a.external { background-color: var(--color-primary-element); color: var(--color-primary-element-text); -- GitLab From d77a9fd9d73a077e191983297bed3286b7b18ed4 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 27 May 2024 15:49:32 -0700 Subject: [PATCH 16/16] added new function --- src/business-banner.js | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/business-banner.js b/src/business-banner.js index 29637d8b..f9d0bc3b 100644 --- a/src/business-banner.js +++ b/src/business-banner.js @@ -26,13 +26,7 @@ document.addEventListener('DOMContentLoaded', function() { 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 + adjustHeaderContent(banner, bannerHeight, topHeight) } } }) @@ -174,13 +168,7 @@ function createCloseButton(banner) { localStorage.setItem('bannerClosed', 'true') const bannerHeight = '0' const topHeight = 'auto' - 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 + adjustHeaderContent(banner, bannerHeight, topHeight) }) return span } @@ -194,3 +182,19 @@ function insertIntoDOM(element) { const parentElement = targetElement.parentNode parentElement.insertBefore(element, targetElement) } + +/** + * + * @param banner + * @param bannerHeight + * @param topHeight + */ +function adjustHeaderContent(banner, bannerHeight, topHeight) { + 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 +} -- GitLab