Digiator commited on
Commit
8e05c03
·
verified ·
1 Parent(s): 4076dc2

Just add a speaking voice for each german word, only speaks german, not english

Browse files

also add a button to display not mastered words only of current list, this is applicable for all lists - Follow Up Deployment

Files changed (2) hide show
  1. index.html +33 -0
  2. prompts.txt +4 -1
index.html CHANGED
@@ -75,6 +75,9 @@
75
  <button id="show-original-btn" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition flex items-center">
76
  <i data-feather="book" class="mr-2"></i> Original List
77
  </button>
 
 
 
78
  </div>
79
  <div id="custom-lists-container" class="flex flex-wrap justify-center gap-2">
80
  <!-- Custom list buttons will be added here -->
@@ -316,6 +319,9 @@
316
  <div class="flashcard-inner h-full">
317
  <div class="flashcard-front bg-white rounded-lg shadow-md p-6 flex flex-col items-center justify-center cursor-pointer h-full">
318
  <h3 class="text-2xl font-bold text-center text-indigo-700">${card.german}</h3>
 
 
 
319
  <p class="text-gray-500 mt-2">Click to flip</p>
320
  ${card.mastered ? '<i data-feather="check-circle" class="text-green-500 mt-2"></i>' : ''}
321
  </div>
@@ -483,6 +489,33 @@
483
  }
484
  });
485
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  // Initial render
487
  renderFlashcards();
488
  renderCustomListButtons();
 
75
  <button id="show-original-btn" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition flex items-center">
76
  <i data-feather="book" class="mr-2"></i> Original List
77
  </button>
78
+ <button id="show-not-mastered-btn" class="px-4 py-2 bg-yellow-600 text-white rounded-lg hover:bg-yellow-700 transition flex items-center">
79
+ <i data-feather="alert-circle" class="mr-2"></i> Not Mastered
80
+ </button>
81
  </div>
82
  <div id="custom-lists-container" class="flex flex-wrap justify-center gap-2">
83
  <!-- Custom list buttons will be added here -->
 
319
  <div class="flashcard-inner h-full">
320
  <div class="flashcard-front bg-white rounded-lg shadow-md p-6 flex flex-col items-center justify-center cursor-pointer h-full">
321
  <h3 class="text-2xl font-bold text-center text-indigo-700">${card.german}</h3>
322
+ <button class="speak-btn mt-2 p-1 bg-indigo-100 rounded-full hover:bg-indigo-200 transition">
323
+ <i data-feather="volume-2" class="text-indigo-700"></i>
324
+ </button>
325
  <p class="text-gray-500 mt-2">Click to flip</p>
326
  ${card.mastered ? '<i data-feather="check-circle" class="text-green-500 mt-2"></i>' : ''}
327
  </div>
 
489
  }
490
  });
491
 
492
+ // Speak German word
493
+ function speakWord(text) {
494
+ const utterance = new SpeechSynthesisUtterance(text);
495
+ utterance.lang = 'de-DE';
496
+ speechSynthesis.speak(utterance);
497
+ }
498
+
499
+ // Show only not mastered words
500
+ document.getElementById('show-not-mastered-btn').addEventListener('click', function() {
501
+ const notMastered = flashcards.filter(card => !card.mastered);
502
+ if (notMastered.length === 0) {
503
+ alert('All words in this list are mastered!');
504
+ return;
505
+ }
506
+ flashcards = [...notMastered];
507
+ renderFlashcards();
508
+ });
509
+
510
+ // Add event delegation for speak buttons
511
+ document.addEventListener('click', function(e) {
512
+ if (e.target.closest('.speak-btn') || e.target.closest('.speak-btn i')) {
513
+ const flashcard = e.target.closest('.flashcard');
514
+ const index = flashcard.dataset.index;
515
+ speakWord(flashcards[index].german);
516
+ }
517
+ });
518
+
519
  // Initial render
520
  renderFlashcards();
521
  renderCustomListButtons();
prompts.txt CHANGED
@@ -422,4 +422,7 @@ it's better to take list name input
422
  when adding a new list
423
  Please enter both a list name and flashcards!
424
 
425
- and no new button added
 
 
 
 
422
  when adding a new list
423
  Please enter both a list name and flashcards!
424
 
425
+ and no new button added
426
+ Just add a speaking voice for each german word, only speaks german, not english
427
+
428
+ also add a button to display not mastered words only of current list, this is applicable for all lists