OzoneAsai commited on
Commit
f2e0d4f
·
verified ·
1 Parent(s): 86df83a

Update templates/flashcards.html

Browse files
Files changed (1) hide show
  1. templates/flashcards.html +13 -13
templates/flashcards.html CHANGED
@@ -11,7 +11,7 @@
11
  <div class="flashcard" id="flashcard">
12
  <div class="content">
13
  <h2 id="card-header">Set: {{ set_name }} ({{ index + 1 }}/{{ total }})</h2>
14
- <p id="card-text"><strong>English:</strong> {{ english }}</p>
15
  <audio controls id="audioPlayer">
16
  <source src="{{ audio_url }}" type="audio/mp3">
17
  Your browser does not support the audio element.
@@ -25,12 +25,12 @@
25
  </div>
26
 
27
  <script>
28
- let showingEnglish = true;
29
  let currentIndex = {{ index }};
30
  const setName = '{{ set_name }}';
31
  const total = {{ total }};
32
- let englishText = "{{ english }}";
33
  let japaneseText = "{{ japanese }}";
 
34
 
35
  const flipBtn = document.getElementById('flipBtn');
36
  const prevBtn = document.getElementById('prevBtn');
@@ -54,18 +54,18 @@
54
  return;
55
  }
56
 
57
- englishText = data.english;
58
  japaneseText = data.japanese;
 
59
  currentIndex = data.index;
60
 
61
  // Update header
62
  cardHeader.innerHTML = `Set: ${data.set_name} (${currentIndex + 1}/${data.total})`;
63
 
64
  // Update text
65
- if (showingEnglish) {
66
- cardText.innerHTML = "<strong>English:</strong> " + englishText;
67
- } else {
68
  cardText.innerHTML = "<strong>Japanese:</strong> " + japaneseText;
 
 
69
  }
70
 
71
  // Update audio
@@ -83,12 +83,12 @@
83
 
84
  // Flip button event
85
  flipBtn.addEventListener('click', function() {
86
- if (showingEnglish) {
87
- cardText.innerHTML = "<strong>Japanese:</strong> " + japaneseText;
88
- showingEnglish = false;
89
  } else {
90
- cardText.innerHTML = "<strong>English:</strong> " + englishText;
91
- showingEnglish = true;
92
  }
93
  });
94
 
@@ -113,4 +113,4 @@
113
  });
114
  </script>
115
  </body>
116
- </html>
 
11
  <div class="flashcard" id="flashcard">
12
  <div class="content">
13
  <h2 id="card-header">Set: {{ set_name }} ({{ index + 1 }}/{{ total }})</h2>
14
+ <p id="card-text"><strong>Japanese:</strong> {{ japanese }}</p>
15
  <audio controls id="audioPlayer">
16
  <source src="{{ audio_url }}" type="audio/mp3">
17
  Your browser does not support the audio element.
 
25
  </div>
26
 
27
  <script>
28
+ let showingJapanese = true;
29
  let currentIndex = {{ index }};
30
  const setName = '{{ set_name }}';
31
  const total = {{ total }};
 
32
  let japaneseText = "{{ japanese }}";
33
+ let chineseText = "{{ chinese }}";
34
 
35
  const flipBtn = document.getElementById('flipBtn');
36
  const prevBtn = document.getElementById('prevBtn');
 
54
  return;
55
  }
56
 
 
57
  japaneseText = data.japanese;
58
+ chineseText = data.chinese;
59
  currentIndex = data.index;
60
 
61
  // Update header
62
  cardHeader.innerHTML = `Set: ${data.set_name} (${currentIndex + 1}/${data.total})`;
63
 
64
  // Update text
65
+ if (showingJapanese) {
 
 
66
  cardText.innerHTML = "<strong>Japanese:</strong> " + japaneseText;
67
+ } else {
68
+ cardText.innerHTML = "<strong>Chinese:</strong> " + chineseText;
69
  }
70
 
71
  // Update audio
 
83
 
84
  // Flip button event
85
  flipBtn.addEventListener('click', function() {
86
+ if (showingJapanese) {
87
+ cardText.innerHTML = "<strong>Chinese:</strong> " + chineseText;
88
+ showingJapanese = false;
89
  } else {
90
+ cardText.innerHTML = "<strong>Japanese:</strong> " + japaneseText;
91
+ showingJapanese = true;
92
  }
93
  });
94
 
 
113
  });
114
  </script>
115
  </body>
116
+ </html>