Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d546c3bd authored by Ronak Patel's avatar Ronak Patel
Browse files

added localstorage to close it permanent

parent 1c975c47
Loading
Loading
Loading
Loading
Loading
+34 −27
Original line number Diff line number Diff line
@@ -4,13 +4,14 @@ import { generateUrl } from '@nextcloud/router'
// 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)
		const textNode = createTextNode(APPLICATION_NAME)
		const link = createLinkElement(APPLICATION_NAME)
	const closeButton = createCloseButton()
		const closeButton = createCloseButton(newDiv)

		contentDiv.appendChild(img)
		contentDiv.appendChild(textNode)
@@ -31,7 +32,7 @@ document.addEventListener('DOMContentLoaded', function() {
			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
}