-
Notifications
You must be signed in to change notification settings - Fork 0
/
nav.js
98 lines (77 loc) · 3.09 KB
/
nav.js
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
document.addEventListener('DOMContentLoaded', function(){
let nav = document.querySelectorAll('#navbutt')
let apple = document.querySelector('.apple')
let special = document.querySelector('.special')
let file = document.querySelector('.file')
let edit = document.querySelector('.edit')
let dropdownsub = document.querySelectorAll('.dropdown')
let canvas = document.querySelector('.canvas')
//adds the inline-style on our dropdown menus
dropdownsub.forEach(element=>{element.style.visibility = "hidden"})
for(const button of nav){
button.addEventListener('click', (event) => {
switch(button.innerHTML){
case "File":
dropdown(file)
hideRemainingNavmenus(file)
break
case "Edit":
dropdown(edit)
hideRemainingNavmenus(edit)
break
case "Special":
dropdown(special)
hideRemainingNavmenus(special)
break
default:
dropdown(apple)
hideRemainingNavmenus(apple)
break
}
})
}
function dropdown(menu){
if(menu.style.visibility === "hidden"){
menu.style.visibility = "visible"
}
else{
menu.style.visibility = "hidden"
}
}
function hideRemainingNavmenus(navbutton){
for(let i = 0; i<dropdownsub.length; i++){
if(dropdownsub[i] !== navbutton){ dropdownsub[i].style.visibility = "hidden"}
}
}
let show = document.getElementById('show')
let about = document.getElementById('about')
let restart = document.getElementById('restart')
let aboutmenu = document.querySelector('.aboutscreen')
let hiddenfiles = document.querySelectorAll('#hiddenfile')
let asukavid = document.querySelector('.ytasuka')
let exitbutton = document.querySelector('.exit')
about.addEventListener('click', event=>{ dropdown(aboutmenu)})
show.addEventListener('click', event=>{
if(show.innerHTML=== "Show Hidden Files"){ show.innerHTML = `Hide Hidden Files`}
else{show.innerHTML = `Show Hidden Files`}
dropdown(hiddenfiles[0])
})
hiddenfiles[0].addEventListener('click', event =>{
dropdown(asukavid)
})
exitbutton.addEventListener('click', event=>{dropdown(asukavid)})
restart.addEventListener('click', ()=>{ location.reload()})
canvas.addEventListener('click', ()=>{hideRemainingNavmenus("all")})
let blinking = document.querySelector('.blinking')
let bios = document.querySelector('.bios')
function blinkfunc(){
if(blinking.style.visibility === "hidden"){ blinking.style.visibility = "visible" }
else{ blinking.style.visibility = "hidden" }
if(bios.style.visibility != "hidden"){setTimeout(blinkfunc, 600)}
else{
blinking.style.visibility = "hidden"
blinking.style.display = "none"
}
}
blinkfunc()
})