buletomato25 commited on
Commit
1bdcba6
·
2 Parent(s): dd60d3f d0b9f6c

Merge branch 'main' of https://huggingface.co/spaces/Justtalk/JusTalk

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