aboutsummaryrefslogtreecommitdiff
path: root/src/js/menu-magic.js
blob: 7abd0500e064ded5e37a7ab7a6d8bab3563d9a36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * Menu bar management
 *
 * We change the visible floor according to menu selection.
 *
 */
var upperFloor = document.querySelector('.upper-floor');
var lowerFloor = document.querySelector('.lower-floor');
upperFloor.style.display = 'flex';
lowerFloor.style.display = 'none';

var modulesSubmenu = document.querySelector('#modules-submenu');
modulesSubmenu.style.display = 'none';
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';
}

var exploreSubmenu = document.querySelector('#explore-submenu');
exploreSubmenu.style.display = 'none';
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';
}

var stellarSubmenu = document.querySelector('#stellar-submenu');
stellarSubmenu.style.display = 'none';
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';
}

// Function to hide all the panes
function menuinit(){
    menuids.forEach(m=>document.querySelector(m).hidden=true);
}

/*
 * Function called on clicks on the menu bar
 * Unhides the pane connected to the clicked menu entry
 */
function menusel(m){
    menuinit();
    // document.querySelector(m.id.replace('/','')).hidden=false;
    locationHashSetter(m.id);
    
    mainContainer.style.display = 'block';
    if ( isMobile ) {
        doubleFloorMenu.style.display = 'none';
    }
}

//var doubleFloorMenuDisplay = doubleFloorMenu.style.display;
function toggleMenu(m){
    mainContainer.style.display = 'none';
    doubleFloorMenu.style.display = 'flex';
}