From 084e3ce6efc49c2d43ce9b44d96e430f8057848e Mon Sep 17 00:00:00 2001 From: kaotisk Date: Fri, 29 Nov 2024 16:18:35 +0200 Subject: Visual improvements --- src/js/ui/menu.js | 53 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 13 deletions(-) (limited to 'src/js/ui/menu.js') diff --git a/src/js/ui/menu.js b/src/js/ui/menu.js index b9cafaa..5344966 100644 --- a/src/js/ui/menu.js +++ b/src/js/ui/menu.js @@ -5,6 +5,7 @@ * @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0 * */ +import { makeElement } from "../arching-kaos-generator.js"; var menuButton = { element: "button", @@ -77,7 +78,6 @@ var stellarSubmenuTemplate = { makeElement(stellarSubmenuTemplate, document.querySelector('.lower-floor')); - /* * Menu bar management * @@ -93,7 +93,7 @@ lowerFloor.style.display = 'none'; var modulesSubmenu = document.querySelector('#modules-submenu'); modulesSubmenu.style.display = 'none'; -function modulesSubToggle(){ +export function modulesSubToggle(){ modulesSubmenu.style.display = modulesSubmenu.style.display === 'none' ? 'flex' : 'none'; upperFloor.style.display = upperFloor.style.display === 'none' ? 'flex' : 'none'; lowerFloor.style.display = lowerFloor.style.display === 'none' ? 'flex' : 'none'; @@ -101,7 +101,7 @@ function modulesSubToggle(){ var exploreSubmenu = document.querySelector('#explore-submenu'); exploreSubmenu.style.display = 'none'; -function exploreSubToggle(){ +export function exploreSubToggle(){ exploreSubmenu.style.display = exploreSubmenu.style.display === 'none' ? 'flex' : 'none'; upperFloor.style.display = upperFloor.style.display === 'none' ? 'flex' : 'none'; lowerFloor.style.display = lowerFloor.style.display === 'none' ? 'flex' : 'none'; @@ -109,22 +109,54 @@ function exploreSubToggle(){ var stellarSubmenu = document.querySelector('#stellar-submenu'); stellarSubmenu.style.display = 'none'; -function stellarSubToggle(){ +export function stellarSubToggle(){ stellarSubmenu.style.display = stellarSubmenu.style.display === 'none' ? 'flex' : 'none'; upperFloor.style.display = upperFloor.style.display === 'none' ? 'flex' : 'none'; lowerFloor.style.display = lowerFloor.style.display === 'none' ? 'flex' : 'none'; } +/* + * Array of all the menu-panes IDs + */ +var menuids = [ + '#welcome-section', + '#about-section', + '#zchain-data-section', + '#news-section', + '#comments-section', + '#stats-section', + '#mixtapes-section', + '#chat-section', + '#radio-section', + '#mypage-section', + '#stellar-balances', + '#stellar-data-config', + '#arching-kaos-node-info', + '#files-section', + '#settings-section', + '#stellar-section', + '#not-found-section' +]; // Function to hide all the panes -function menuinit(){ - menuids.forEach(m=>document.querySelector(m).hidden=true); +export function menuinit(){ + for ( var i = 0; i < menuids.length; i++ ){ + var sec = document.querySelector(menuids[i]); + if ( sec !== null ) + { + sec.hidden = true; + } + else + { + console.log(`menuinit: ${menuids[i]} was not found`); + } + } } /* * Function called on clicks on the menu bar * Unhides the pane connected to the clicked menu entry */ -function menusel(m){ +export function menusel(m){ menuinit(); // document.querySelector(m.id.replace('/','')).hidden=false; locationHashSetter(m.id); @@ -135,14 +167,9 @@ function menusel(m){ } } -function toggleMenu(){ +export function toggleMenu(){ mainContainer.style.display = 'none'; doubleFloorMenu.style.display = 'flex'; } -// And call -menuinit(); -locationHashOnChange(); - -isMobile ? doubleFloorMenu.style.display = 'none':doubleFloorMenu.style.display = 'flex'; // @license-end -- cgit v1.2.3