Dembo commited on
Commit
b99ba36
·
verified ·
1 Parent(s): 96fd11f

make it allow to practice words

Browse files
Files changed (1) hide show
  1. index.html +63 -27
index.html CHANGED
@@ -56,10 +56,10 @@
56
  <p class="mb-2"><span class="font-semibold">Meaning:</span> To provide lodging or space for someone.</p>
57
  <p class="mb-2"><span class="font-semibold">Tip:</span> Remember it has two Cs and two Ms.</p>
58
  </div>
59
- <button class="w-full bg-indigo-500 hover:bg-indigo-600 text-white font-medium py-2 px-4 rounded-md transition-colors">
60
  Practice This Word
61
  </button>
62
- </div>
63
  </div>
64
 
65
  <!-- Word Card 2 -->
@@ -71,10 +71,10 @@
71
  <p class="mb-2"><span class="font-semibold">Meaning:</span> To cause someone to feel self-conscious.</p>
72
  <p class="mb-2"><span class="font-semibold">Tip:</span> Double R and double S - it's embarrassing to forget!</p>
73
  </div>
74
- <button class="w-full bg-purple-500 hover:bg-purple-600 text-white font-medium py-2 px-4 rounded-md transition-colors">
75
  Practice This Word
76
  </button>
77
- </div>
78
  </div>
79
 
80
  <!-- Word Card 3 -->
@@ -86,10 +86,10 @@
86
  <p class="mb-2"><span class="font-semibold">Meaning:</span> The process of maintaining something.</p>
87
  <p class="mb-2"><span class="font-semibold">Tip:</span> Contains "ten" in the middle.</p>
88
  </div>
89
- <button class="w-full bg-indigo-500 hover:bg-indigo-600 text-white font-medium py-2 px-4 rounded-md transition-colors">
90
  Practice This Word
91
  </button>
92
- </div>
93
  </div>
94
 
95
  <!-- Word Card 4 -->
@@ -101,10 +101,10 @@
101
  <p class="mb-2"><span class="font-semibold">Meaning:</span> An inner feeling of right and wrong.</p>
102
  <p class="mb-2"><span class="font-semibold">Tip:</span> Remember "science" is in "conscience".</p>
103
  </div>
104
- <button class="w-full bg-purple-500 hover:bg-purple-600 text-white font-medium py-2 px-4 rounded-md transition-colors">
105
  Practice This Word
106
  </button>
107
- </div>
108
  </div>
109
 
110
  <!-- Word Card 5 -->
@@ -116,10 +116,10 @@
116
  <p class="mb-2"><span class="font-semibold">Meaning:</span> A strong, regular repeated pattern.</p>
117
  <p class="mb-2"><span class="font-semibold">Tip:</span> No vowels except the Y!</p>
118
  </div>
119
- <button class="w-full bg-indigo-500 hover:bg-indigo-600 text-white font-medium py-2 px-4 rounded-md transition-colors">
120
  Practice This Word
121
  </button>
122
- </div>
123
  </div>
124
 
125
  <!-- Add Your Own Card -->
@@ -140,26 +140,30 @@
140
  <div class="p-8">
141
  <h2 class="text-2xl font-bold text-center text-indigo-800 mb-6">Practice Zone</h2>
142
  <div class="mb-6">
 
 
 
 
143
  <label for="practice-word" class="block text-sm font-medium text-gray-700 mb-2">Type the word you hear:</label>
144
  <div class="flex items-center space-x-2 mb-4">
145
  <input type="text" id="practice-word" class="flex-1 px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500" placeholder="Spell the word...">
146
  <button id="play-word" class="p-2 bg-indigo-100 text-indigo-600 rounded-md hover:bg-indigo-200 transition-colors">
147
  <i data-feather="volume-2" class="w-5 h-5"></i>
148
  </button>
149
- </div>
150
  <div id="feedback" class="hidden mt-2 p-3 rounded-md"></div>
151
  </div>
152
  <div class="flex justify-center space-x-4">
153
  <button id="check-spelling" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-2 px-6 rounded-md transition-colors">
154
- Check Spelling
155
- </button>
156
- <button id="new-word" class="bg-purple-600 hover:bg-purple-700 text-white font-medium py-2 px-6 rounded-md transition-colors">
157
- New Word
158
- </button>
159
- </div>
160
  </div>
161
  </div>
162
- </main>
 
163
 
164
  <!-- Footer -->
165
  <footer class="mt-12 py-8 px-4 sm:px-6 lg:px-8 bg-indigo-800 text-white">
@@ -205,37 +209,69 @@
205
  document.addEventListener('DOMContentLoaded', function() {
206
  feather.replace();
207
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
- // Simple demo functionality
210
  document.addEventListener('DOMContentLoaded', function() {
 
 
 
211
  document.getElementById('check-spelling').addEventListener('click', function() {
212
  const input = document.getElementById('practice-word');
213
  const feedback = document.getElementById('feedback');
214
 
215
- if (input.value.toLowerCase() === 'accommodate') {
216
  feedback.className = 'bg-green-100 text-green-800 mt-2 p-3 rounded-md';
217
  feedback.innerHTML = '<i data-feather="check-circle" class="w-5 h-5 inline mr-2"></i> Correct! Well done!';
218
  } else {
219
  feedback.className = 'bg-red-100 text-red-800 mt-2 p-3 rounded-md';
220
- feedback.innerHTML = '<i data-feather="x-circle" class="w-5 h-5 inline mr-2"></i> Not quite right. Try again!';
221
  }
222
 
223
  feedback.classList.remove('hidden');
224
  feather.replace();
225
  });
 
226
  document.getElementById('new-word').addEventListener('click', function() {
227
- document.getElementById('practice-word').value = '';
228
- document.getElementById('feedback').classList.add('hidden');
 
 
 
 
 
 
 
 
 
 
 
229
  });
 
230
  document.getElementById('play-word').addEventListener('click', function() {
231
  // Use Web Speech API to speak the word
232
- const word = 'accommodate'; // Current practice word
233
- const utterance = new SpeechSynthesisUtterance(word);
234
  utterance.rate = 0.8;
235
  utterance.pitch = 1;
236
  speechSynthesis.speak(utterance);
237
  });
238
- });
239
- </script>
240
  </body>
241
  </html>
 
56
  <p class="mb-2"><span class="font-semibold">Meaning:</span> To provide lodging or space for someone.</p>
57
  <p class="mb-2"><span class="font-semibold">Tip:</span> Remember it has two Cs and two Ms.</p>
58
  </div>
59
+ <button onclick="practiceWord('Accommodate', '/əˈkɒmədeɪt/')" class="w-full bg-indigo-500 hover:bg-indigo-600 text-white font-medium py-2 px-4 rounded-md transition-colors">
60
  Practice This Word
61
  </button>
62
+ </div>
63
  </div>
64
 
65
  <!-- Word Card 2 -->
 
71
  <p class="mb-2"><span class="font-semibold">Meaning:</span> To cause someone to feel self-conscious.</p>
72
  <p class="mb-2"><span class="font-semibold">Tip:</span> Double R and double S - it's embarrassing to forget!</p>
73
  </div>
74
+ <button onclick="practiceWord('Embarrass', '/ɪmˈbærəs/')" class="w-full bg-purple-500 hover:bg-purple-600 text-white font-medium py-2 px-4 rounded-md transition-colors">
75
  Practice This Word
76
  </button>
77
+ </div>
78
  </div>
79
 
80
  <!-- Word Card 3 -->
 
86
  <p class="mb-2"><span class="font-semibold">Meaning:</span> The process of maintaining something.</p>
87
  <p class="mb-2"><span class="font-semibold">Tip:</span> Contains "ten" in the middle.</p>
88
  </div>
89
+ <button onclick="practiceWord('Maintenance', '/ˈmeɪntənəns/')" class="w-full bg-indigo-500 hover:bg-indigo-600 text-white font-medium py-2 px-4 rounded-md transition-colors">
90
  Practice This Word
91
  </button>
92
+ </div>
93
  </div>
94
 
95
  <!-- Word Card 4 -->
 
101
  <p class="mb-2"><span class="font-semibold">Meaning:</span> An inner feeling of right and wrong.</p>
102
  <p class="mb-2"><span class="font-semibold">Tip:</span> Remember "science" is in "conscience".</p>
103
  </div>
104
+ <button onclick="practiceWord('Conscience', '/ˈkɒnʃəns/')" class="w-full bg-purple-500 hover:bg-purple-600 text-white font-medium py-2 px-4 rounded-md transition-colors">
105
  Practice This Word
106
  </button>
107
+ </div>
108
  </div>
109
 
110
  <!-- Word Card 5 -->
 
116
  <p class="mb-2"><span class="font-semibold">Meaning:</span> A strong, regular repeated pattern.</p>
117
  <p class="mb-2"><span class="font-semibold">Tip:</span> No vowels except the Y!</p>
118
  </div>
119
+ <button onclick="practiceWord('Rhythm', '/ˈrɪðəm/')" class="w-full bg-indigo-500 hover:bg-indigo-600 text-white font-medium py-2 px-4 rounded-md transition-colors">
120
  Practice This Word
121
  </button>
122
+ </div>
123
  </div>
124
 
125
  <!-- Add Your Own Card -->
 
140
  <div class="p-8">
141
  <h2 class="text-2xl font-bold text-center text-indigo-800 mb-6">Practice Zone</h2>
142
  <div class="mb-6">
143
+ <div class="text-center mb-4">
144
+ <div id="current-word" class="text-2xl font-bold text-indigo-700"></div>
145
+ <div id="current-pronunciation" class="text-gray-500 mt-1"></div>
146
+ </div>
147
  <label for="practice-word" class="block text-sm font-medium text-gray-700 mb-2">Type the word you hear:</label>
148
  <div class="flex items-center space-x-2 mb-4">
149
  <input type="text" id="practice-word" class="flex-1 px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500" placeholder="Spell the word...">
150
  <button id="play-word" class="p-2 bg-indigo-100 text-indigo-600 rounded-md hover:bg-indigo-200 transition-colors">
151
  <i data-feather="volume-2" class="w-5 h-5"></i>
152
  </button>
153
+ </div>
154
  <div id="feedback" class="hidden mt-2 p-3 rounded-md"></div>
155
  </div>
156
  <div class="flex justify-center space-x-4">
157
  <button id="check-spelling" class="bg-indigo-600 hover:bg-indigo-700 text-white font-medium py-2 px-6 rounded-md transition-colors">
158
+ Check Spelling
159
+ </button>
160
+ <button id="new-word" class="bg-purple-600 hover:bg-purple-700 text-white font-medium py-2 px-6 rounded-md transition-colors">
161
+ New Word
162
+ </button>
 
163
  </div>
164
  </div>
165
+ </div>
166
+ </main>
167
 
168
  <!-- Footer -->
169
  <footer class="mt-12 py-8 px-4 sm:px-6 lg:px-8 bg-indigo-800 text-white">
 
209
  document.addEventListener('DOMContentLoaded', function() {
210
  feather.replace();
211
  });
212
+ // Practice functionality
213
+ let currentPracticeWord = '';
214
+ let currentPracticePronunciation = '';
215
+
216
+ function practiceWord(word, pronunciation) {
217
+ currentPracticeWord = word;
218
+ currentPracticePronunciation = pronunciation;
219
+
220
+ document.getElementById('current-word').textContent = word;
221
+ document.getElementById('current-pronunciation').textContent = pronunciation;
222
+ document.getElementById('practice-word').value = '';
223
+ document.getElementById('feedback').classList.add('hidden');
224
+
225
+ // Scroll to practice area
226
+ document.querySelector('.mt-12').scrollIntoView({
227
+ behavior: 'smooth'
228
+ });
229
+ }
230
 
 
231
  document.addEventListener('DOMContentLoaded', function() {
232
+ // Initialize with first word
233
+ practiceWord('Accommodate', '/əˈkɒmədeɪt/');
234
+
235
  document.getElementById('check-spelling').addEventListener('click', function() {
236
  const input = document.getElementById('practice-word');
237
  const feedback = document.getElementById('feedback');
238
 
239
+ if (input.value.toLowerCase() === currentPracticeWord.toLowerCase()) {
240
  feedback.className = 'bg-green-100 text-green-800 mt-2 p-3 rounded-md';
241
  feedback.innerHTML = '<i data-feather="check-circle" class="w-5 h-5 inline mr-2"></i> Correct! Well done!';
242
  } else {
243
  feedback.className = 'bg-red-100 text-red-800 mt-2 p-3 rounded-md';
244
+ feedback.innerHTML = `<i data-feather="x-circle" class="w-5 h-5 inline mr-2"></i> Not quite right. The correct spelling is: <strong>${currentPracticeWord}</strong>`;
245
  }
246
 
247
  feedback.classList.remove('hidden');
248
  feather.replace();
249
  });
250
+
251
  document.getElementById('new-word').addEventListener('click', function() {
252
+ // Cycle through available words
253
+ const words = [
254
+ { word: 'Accommodate', pronunciation: '/əˈkɒmədeɪt/' },
255
+ { word: 'Embarrass', pronunciation: '/ɪmˈbærəs/' },
256
+ { word: 'Maintenance', pronunciation: '/ˈmeɪntənəns/' },
257
+ { word: 'Conscience', pronunciation: '/ˈkɒnʃəns/' },
258
+ { word: 'Rhythm', pronunciation: '/ˈrɪðəm/' }
259
+ ];
260
+
261
+ const currentIndex = words.findIndex(w => w.word === currentPracticeWord);
262
+ const nextIndex = (currentIndex + 1) % words.length;
263
+
264
+ practiceWord(words[nextIndex].word, words[nextIndex].pronunciation);
265
  });
266
+
267
  document.getElementById('play-word').addEventListener('click', function() {
268
  // Use Web Speech API to speak the word
269
+ const utterance = new SpeechSynthesisUtterance(currentPracticeWord);
 
270
  utterance.rate = 0.8;
271
  utterance.pitch = 1;
272
  speechSynthesis.speak(utterance);
273
  });
274
+ });
275
+ </script>
276
  </body>
277
  </html>