Loading lib/Listeners/BeforeTemplateRenderedListener.php +0 −4 Original line number Diff line number Diff line Loading @@ -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'); // } } } Loading src/business-banner.js +15 −4 Original line number Diff line number Diff line 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' 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) Loading Loading @@ -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 } Loading Loading
lib/Listeners/BeforeTemplateRenderedListener.php +0 −4 Original line number Diff line number Diff line Loading @@ -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'); // } } } Loading
src/business-banner.js +15 −4 Original line number Diff line number Diff line 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' 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) Loading Loading @@ -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 } Loading