aboutsummaryrefslogtreecommitdiff
path: root/src/js/ui/menu.js
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-11-29 16:18:35 +0200
committerkaotisk <kaotisk@arching-kaos.org>2024-11-29 16:18:35 +0200
commit084e3ce6efc49c2d43ce9b44d96e430f8057848e (patch)
treed0369baa64a57b8fcc224135918b421028e2d36e /src/js/ui/menu.js
parent1dab98b6617b4dc6c36c57794895725bb8ef3d47 (diff)
downloadarching-kaos-web-ui-084e3ce6efc49c2d43ce9b44d96e430f8057848e.tar.gz
arching-kaos-web-ui-084e3ce6efc49c2d43ce9b44d96e430f8057848e.tar.bz2
arching-kaos-web-ui-084e3ce6efc49c2d43ce9b44d96e430f8057848e.zip
Visual improvements
Diffstat (limited to 'src/js/ui/menu.js')
-rw-r--r--src/js/ui/menu.js53
1 files changed, 40 insertions, 13 deletions
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