Spaces:
Running
Running
Update static/menu.js
Browse files- static/menu.js +24 -6
static/menu.js
CHANGED
@@ -1,27 +1,38 @@
|
|
1 |
-
|
|
|
|
|
2 |
fetch("/reset");
|
3 |
window.location.href = "userregister";
|
4 |
}
|
|
|
|
|
5 |
function showRecorder() {
|
6 |
window.location.href = "index";
|
7 |
}
|
|
|
|
|
8 |
function showResults() {
|
9 |
window.location.href = "feedback";
|
10 |
}
|
|
|
|
|
11 |
function showTalkDetail() {
|
12 |
window.location.href = "talk_detail";
|
13 |
}
|
|
|
|
|
14 |
function resetAction() {
|
15 |
window.location.href = "reset_html";
|
16 |
}
|
17 |
|
18 |
-
//
|
19 |
-
function toggleMenu(event) {
|
20 |
-
event.stopPropagation();
|
21 |
const menu = document.getElementById("menu");
|
22 |
menu.classList.toggle("open");
|
23 |
}
|
24 |
-
|
|
|
25 |
function closeMenu(event) {
|
26 |
const menu = document.getElementById("menu");
|
27 |
if (
|
@@ -31,4 +42,11 @@ function toggleMenu(event) {
|
|
31 |
) {
|
32 |
menu.classList.remove("open");
|
33 |
}
|
34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script>
|
2 |
+
// Show user registration page
|
3 |
+
function showUserRegister() {
|
4 |
fetch("/reset");
|
5 |
window.location.href = "userregister";
|
6 |
}
|
7 |
+
|
8 |
+
// Show recorder page
|
9 |
function showRecorder() {
|
10 |
window.location.href = "index";
|
11 |
}
|
12 |
+
|
13 |
+
// Show results page
|
14 |
function showResults() {
|
15 |
window.location.href = "feedback";
|
16 |
}
|
17 |
+
|
18 |
+
// Show talk detail page
|
19 |
function showTalkDetail() {
|
20 |
window.location.href = "talk_detail";
|
21 |
}
|
22 |
+
|
23 |
+
// Reset action page
|
24 |
function resetAction() {
|
25 |
window.location.href = "reset_html";
|
26 |
}
|
27 |
|
28 |
+
// Toggle hamburger menu visibility
|
29 |
+
function toggleMenu(event) {
|
30 |
+
event.stopPropagation(); // Prevents click event from propagating to the document
|
31 |
const menu = document.getElementById("menu");
|
32 |
menu.classList.toggle("open");
|
33 |
}
|
34 |
+
|
35 |
+
// Close the menu if clicked outside
|
36 |
function closeMenu(event) {
|
37 |
const menu = document.getElementById("menu");
|
38 |
if (
|
|
|
42 |
) {
|
43 |
menu.classList.remove("open");
|
44 |
}
|
45 |
+
}
|
46 |
+
|
47 |
+
// Add event listener for closing the menu when clicking outside
|
48 |
+
document.addEventListener("click", closeMenu);
|
49 |
+
|
50 |
+
// Show recorder page
|
51 |
+
document.getElementById("add-btn").addEventListener("click", showRecorder);
|
52 |
+
</script>
|