Spaces:
Running
Running
Add 2 files
Browse files- index.html +215 -26
- prompts.txt +2 -0
index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
<style>
|
|
@@ -44,13 +44,17 @@
|
|
| 44 |
0%, 100% { transform: translateY(0); }
|
| 45 |
50% { transform: translateY(-10px); }
|
| 46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
</style>
|
| 48 |
</head>
|
| 49 |
<body class="bg-gradient-to-br from-blue-50 to-indigo-100 min-h-screen">
|
| 50 |
<div class="container mx-auto px-4 py-8">
|
| 51 |
<header class="text-center mb-8">
|
| 52 |
<h1 class="text-4xl font-bold text-indigo-800 mb-2">Vocabulary Master</h1>
|
| 53 |
-
<p class="text-gray-600">Learn English words effectively</p>
|
| 54 |
</header>
|
| 55 |
|
| 56 |
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
@@ -78,7 +82,7 @@
|
|
| 78 |
<div class="mt-6">
|
| 79 |
<h3 class="text-lg font-medium text-gray-800 mb-3">Your Vocabulary List</h3>
|
| 80 |
<div id="wordList" class="max-h-60 overflow-y-auto border border-gray-200 rounded-lg p-2">
|
| 81 |
-
|
| 82 |
</div>
|
| 83 |
<div class="mt-3 flex space-x-2">
|
| 84 |
<button id="clearWordsBtn" class="flex-1 bg-red-100 text-red-700 py-1 px-3 rounded hover:bg-red-200 transition">
|
|
@@ -302,8 +306,121 @@
|
|
| 302 |
</div>
|
| 303 |
|
| 304 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
// Vocabulary data storage
|
| 306 |
-
let vocabulary = JSON.parse(localStorage.getItem('vocabulary')) ||
|
| 307 |
let knownWords = JSON.parse(localStorage.getItem('knownWords')) || [];
|
| 308 |
|
| 309 |
// Current game state
|
|
@@ -379,6 +496,11 @@
|
|
| 379 |
|
| 380 |
// Initialize the app
|
| 381 |
function init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 382 |
updateWordList();
|
| 383 |
updateProgress();
|
| 384 |
setupEventListeners();
|
|
@@ -426,6 +548,15 @@
|
|
| 426 |
checkTypingBtn.addEventListener('click', checkTypingAnswer);
|
| 427 |
nextTypingBtn.addEventListener('click', showNextTyping);
|
| 428 |
closeTyping.addEventListener('click', () => typingModal.classList.add('hidden'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 429 |
}
|
| 430 |
|
| 431 |
// Add a new word to vocabulary
|
|
@@ -470,8 +601,8 @@
|
|
| 470 |
|
| 471 |
// Clear all words
|
| 472 |
function clearWords() {
|
| 473 |
-
if (confirm('Are you sure you want to clear all words?')) {
|
| 474 |
-
vocabulary = [];
|
| 475 |
knownWords = [];
|
| 476 |
saveVocabulary();
|
| 477 |
updateWordList();
|
|
@@ -562,29 +693,58 @@
|
|
| 562 |
}
|
| 563 |
|
| 564 |
wordList.innerHTML = '';
|
| 565 |
-
|
| 566 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 567 |
|
| 568 |
-
const
|
| 569 |
-
|
|
|
|
| 570 |
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
<
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 586 |
|
| 587 |
-
wordList.appendChild(
|
| 588 |
});
|
| 589 |
|
| 590 |
// Add event listeners for dynamically created buttons
|
|
@@ -616,6 +776,14 @@
|
|
| 616 |
// Delete a word from vocabulary
|
| 617 |
function deleteWord(e) {
|
| 618 |
const index = parseInt(e.target.closest('button').getAttribute('data-index'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 619 |
vocabulary.splice(index, 1);
|
| 620 |
|
| 621 |
// Remove from known words if it was there
|
|
@@ -702,6 +870,27 @@
|
|
| 702 |
flashcard.classList.toggle('flipped');
|
| 703 |
}
|
| 704 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 705 |
// Show previous flashcard
|
| 706 |
function showPreviousCard() {
|
| 707 |
if (currentFlashcardIndex > 0) {
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Vocabulary Master - 100 Common English Words</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
<style>
|
|
|
|
| 44 |
0%, 100% { transform: translateY(0); }
|
| 45 |
50% { transform: translateY(-10px); }
|
| 46 |
}
|
| 47 |
+
.word-category {
|
| 48 |
+
background-color: rgba(99, 102, 241, 0.1);
|
| 49 |
+
border-left: 4px solid #6366f1;
|
| 50 |
+
}
|
| 51 |
</style>
|
| 52 |
</head>
|
| 53 |
<body class="bg-gradient-to-br from-blue-50 to-indigo-100 min-h-screen">
|
| 54 |
<div class="container mx-auto px-4 py-8">
|
| 55 |
<header class="text-center mb-8">
|
| 56 |
<h1 class="text-4xl font-bold text-indigo-800 mb-2">Vocabulary Master</h1>
|
| 57 |
+
<p class="text-gray-600">Learn 100 common English words effectively</p>
|
| 58 |
</header>
|
| 59 |
|
| 60 |
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
|
|
| 82 |
<div class="mt-6">
|
| 83 |
<h3 class="text-lg font-medium text-gray-800 mb-3">Your Vocabulary List</h3>
|
| 84 |
<div id="wordList" class="max-h-60 overflow-y-auto border border-gray-200 rounded-lg p-2">
|
| 85 |
+
<!-- Words will be loaded here -->
|
| 86 |
</div>
|
| 87 |
<div class="mt-3 flex space-x-2">
|
| 88 |
<button id="clearWordsBtn" class="flex-1 bg-red-100 text-red-700 py-1 px-3 rounded hover:bg-red-200 transition">
|
|
|
|
| 306 |
</div>
|
| 307 |
|
| 308 |
<script>
|
| 309 |
+
// Default vocabulary with 100 common English words
|
| 310 |
+
const defaultVocabulary = [
|
| 311 |
+
// Basic Verbs (1-20)
|
| 312 |
+
{ english: "be", vietnamese: "thì, là, ở", example: "I am happy" },
|
| 313 |
+
{ english: "have", vietnamese: "có", example: "I have a book" },
|
| 314 |
+
{ english: "do", vietnamese: "làm", example: "What are you doing?" },
|
| 315 |
+
{ english: "say", vietnamese: "nói", example: "She says hello" },
|
| 316 |
+
{ english: "go", vietnamese: "đi", example: "Let's go home" },
|
| 317 |
+
{ english: "get", vietnamese: "nhận được", example: "I got a gift" },
|
| 318 |
+
{ english: "make", vietnamese: "làm, tạo ra", example: "She makes cakes" },
|
| 319 |
+
{ english: "know", vietnamese: "biết", example: "I know the answer" },
|
| 320 |
+
{ english: "think", vietnamese: "nghĩ", example: "I think so" },
|
| 321 |
+
{ english: "take", vietnamese: "lấy", example: "Take your time" },
|
| 322 |
+
{ english: "see", vietnamese: "nhìn thấy", example: "I see a bird" },
|
| 323 |
+
{ english: "come", vietnamese: "đến", example: "Come here please" },
|
| 324 |
+
{ english: "want", vietnamese: "muốn", example: "I want coffee" },
|
| 325 |
+
{ english: "look", vietnamese: "nhìn", example: "Look at that!" },
|
| 326 |
+
{ english: "use", vietnamese: "sử dụng", example: "Can I use your phone?" },
|
| 327 |
+
{ english: "find", vietnamese: "tìm thấy", example: "I found my keys" },
|
| 328 |
+
{ english: "give", vietnamese: "đưa cho", example: "Give me the book" },
|
| 329 |
+
{ english: "tell", vietnamese: "nói với", example: "Tell me a story" },
|
| 330 |
+
{ english: "work", vietnamese: "làm việc", example: "I work at a bank" },
|
| 331 |
+
{ english: "call", vietnamese: "gọi", example: "Call me later" },
|
| 332 |
+
|
| 333 |
+
// Common Nouns (21-40)
|
| 334 |
+
{ english: "time", vietnamese: "thời gian", example: "What time is it?" },
|
| 335 |
+
{ english: "person", vietnamese: "người", example: "She's a nice person" },
|
| 336 |
+
{ english: "year", vietnamese: "năm", example: "Happy new year!" },
|
| 337 |
+
{ english: "day", vietnamese: "ngày", example: "Have a nice day" },
|
| 338 |
+
{ english: "thing", vietnamese: "thứ, vật", example: "What's that thing?" },
|
| 339 |
+
{ english: "man", vietnamese: "đàn ông", example: "That man is tall" },
|
| 340 |
+
{ english: "world", vietnamese: "thế giới", example: "Travel around the world" },
|
| 341 |
+
{ english: "life", vietnamese: "cuộc sống", example: "Enjoy your life" },
|
| 342 |
+
{ english: "hand", vietnamese: "bàn tay", example: "Raise your hand" },
|
| 343 |
+
{ english: "part", vietnamese: "phần", example: "Part of the cake" },
|
| 344 |
+
{ english: "child", vietnamese: "đứa trẻ", example: "She has two children" },
|
| 345 |
+
{ english: "eye", vietnamese: "mắt", example: "My eyes are brown" },
|
| 346 |
+
{ english: "woman", vietnamese: "phụ nữ", example: "That woman is my teacher" },
|
| 347 |
+
{ english: "place", vietnamese: "nơi chốn", example: "This is a nice place" },
|
| 348 |
+
{ english: "week", vietnamese: "tuần", example: "See you next week" },
|
| 349 |
+
{ english: "case", vietnamese: "trường hợp", example: "In that case..." },
|
| 350 |
+
{ english: "point", vietnamese: "điểm", example: "Good point!" },
|
| 351 |
+
{ english: "government", vietnamese: "chính phủ", example: "The government announced..." },
|
| 352 |
+
{ english: "company", vietnamese: "công ty", example: "I work for a tech company" },
|
| 353 |
+
{ english: "number", vietnamese: "số", example: "Pick a number" },
|
| 354 |
+
|
| 355 |
+
// Adjectives (41-60)
|
| 356 |
+
{ english: "good", vietnamese: "tốt", example: "Good job!" },
|
| 357 |
+
{ english: "new", vietnamese: "mới", example: "I bought a new phone" },
|
| 358 |
+
{ english: "first", vietnamese: "đầu tiên", example: "My first time" },
|
| 359 |
+
{ english: "last", vietnamese: "cuối cùng", example: "The last page" },
|
| 360 |
+
{ english: "long", vietnamese: "dài", example: "A long road" },
|
| 361 |
+
{ english: "great", vietnamese: "tuyệt vời", example: "Great idea!" },
|
| 362 |
+
{ english: "little", vietnamese: "nhỏ", example: "A little dog" },
|
| 363 |
+
{ english: "own", vietnamese: "riêng", example: "My own house" },
|
| 364 |
+
{ english: "other", vietnamese: "khác", example: "Other people" },
|
| 365 |
+
{ english: "old", vietnamese: "cũ, già", example: "An old friend" },
|
| 366 |
+
{ english: "right", vietnamese: "đúng, phải", example: "You're right" },
|
| 367 |
+
{ english: "big", vietnamese: "lớn", example: "A big city" },
|
| 368 |
+
{ english: "high", vietnamese: "cao", example: "High mountains" },
|
| 369 |
+
{ english: "different", vietnamese: "khác biệt", example: "Different opinions" },
|
| 370 |
+
{ english: "small", vietnamese: "nhỏ", example: "A small gift" },
|
| 371 |
+
{ english: "large", vietnamese: "rộng lớn", example: "A large room" },
|
| 372 |
+
{ english: "next", vietnamese: "tiếp theo", example: "Next week" },
|
| 373 |
+
{ english: "early", vietnamese: "sớm", example: "Early morning" },
|
| 374 |
+
{ english: "young", vietnamese: "trẻ", example: "Young people" },
|
| 375 |
+
{ english: "important", vietnamese: "quan trọng", example: "Important news" },
|
| 376 |
+
|
| 377 |
+
// Common Words (61-80)
|
| 378 |
+
{ english: "the", vietnamese: "cái, con, người (mạo từ)", example: "The book is interesting" },
|
| 379 |
+
{ english: "and", vietnamese: "và", example: "You and me" },
|
| 380 |
+
{ english: "that", vietnamese: "đó, kia", example: "That book is mine" },
|
| 381 |
+
{ english: "it", vietnamese: "nó", example: "It is raining" },
|
| 382 |
+
{ english: "not", vietnamese: "không", example: "I'm not sure" },
|
| 383 |
+
{ english: "he", vietnamese: "anh ấy", example: "He is my brother" },
|
| 384 |
+
{ english: "as", vietnamese: "như", example: "As you wish" },
|
| 385 |
+
{ english: "at", vietnamese: "ở, tại", example: "At home" },
|
| 386 |
+
{ english: "by", vietnamese: "bởi, bằng", example: "By bus" },
|
| 387 |
+
{ english: "from", vietnamese: "từ", example: "From Vietnam" },
|
| 388 |
+
{ english: "or", vietnamese: "hoặc", example: "Tea or coffee?" },
|
| 389 |
+
{ english: "one", vietnamese: "một", example: "One dollar" },
|
| 390 |
+
{ english: "all", vietnamese: "tất cả", example: "All students" },
|
| 391 |
+
{ english: "would", vietnamese: "sẽ", example: "I would like to go" },
|
| 392 |
+
{ english: "there", vietnamese: "ở đó", example: "Go there" },
|
| 393 |
+
{ english: "their", vietnamese: "của họ", example: "Their house" },
|
| 394 |
+
{ english: "what", vietnamese: "cái gì", example: "What is this?" },
|
| 395 |
+
{ english: "so", vietnamese: "vì vậy", example: "I'm tired, so I'll rest" },
|
| 396 |
+
{ english: "up", vietnamese: "lên", example: "Stand up" },
|
| 397 |
+
{ english: "out", vietnamese: "ra ngoài", example: "Get out" },
|
| 398 |
+
|
| 399 |
+
// Useful Words (81-100)
|
| 400 |
+
{ english: "about", vietnamese: "về", example: "Tell me about yourself" },
|
| 401 |
+
{ english: "who", vietnamese: "ai", example: "Who is that?" },
|
| 402 |
+
{ english: "which", vietnamese: "cái nào", example: "Which one do you want?" },
|
| 403 |
+
{ english: "when", vietnamese: "khi nào", example: "When are you coming?" },
|
| 404 |
+
{ english: "where", vietnamese: "ở đâu", example: "Where is the station?" },
|
| 405 |
+
{ english: "why", vietnamese: "tại sao", example: "Why are you late?" },
|
| 406 |
+
{ english: "how", vietnamese: "như thế nào", example: "How does it work?" },
|
| 407 |
+
{ english: "some", vietnamese: "một vài", example: "I need some help" },
|
| 408 |
+
{ english: "more", vietnamese: "nhiều hơn", example: "I want more time" },
|
| 409 |
+
{ english: "most", vietnamese: "hầu hết", example: "Most people agree" },
|
| 410 |
+
{ english: "many", vietnamese: "nhiều", example: "Many thanks" },
|
| 411 |
+
{ english: "then", vietnamese: "sau đó", example: "We ate, then left" },
|
| 412 |
+
{ english: "now", vietnamese: "bây giờ", example: "Do it now" },
|
| 413 |
+
{ english: "only", vietnamese: "chỉ", example: "Only one person" },
|
| 414 |
+
{ english: "also", vietnamese: "cũng", example: "I also like tea" },
|
| 415 |
+
{ english: "very", vietnamese: "rất", example: "Very good" },
|
| 416 |
+
{ english: "even", vietnamese: "thậm chí", example: "Even children know" },
|
| 417 |
+
{ english: "back", vietnamese: "trở lại", example: "Come back soon" },
|
| 418 |
+
{ english: "any", vietnamese: "bất kỳ", example: "Any questions?" },
|
| 419 |
+
{ english: "well", vietnamese: "tốt", example: "You did well" }
|
| 420 |
+
];
|
| 421 |
+
|
| 422 |
// Vocabulary data storage
|
| 423 |
+
let vocabulary = JSON.parse(localStorage.getItem('vocabulary')) || defaultVocabulary;
|
| 424 |
let knownWords = JSON.parse(localStorage.getItem('knownWords')) || [];
|
| 425 |
|
| 426 |
// Current game state
|
|
|
|
| 496 |
|
| 497 |
// Initialize the app
|
| 498 |
function init() {
|
| 499 |
+
// If no vocabulary in localStorage, save the default
|
| 500 |
+
if (!localStorage.getItem('vocabulary')) {
|
| 501 |
+
saveVocabulary();
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
updateWordList();
|
| 505 |
updateProgress();
|
| 506 |
setupEventListeners();
|
|
|
|
| 548 |
checkTypingBtn.addEventListener('click', checkTypingAnswer);
|
| 549 |
nextTypingBtn.addEventListener('click', showNextTyping);
|
| 550 |
closeTyping.addEventListener('click', () => typingModal.classList.add('hidden'));
|
| 551 |
+
|
| 552 |
+
// Know/Don't know buttons (event delegation)
|
| 553 |
+
document.addEventListener('click', function(e) {
|
| 554 |
+
if (e.target.classList.contains('knowBtn')) {
|
| 555 |
+
markWordAsKnown(true);
|
| 556 |
+
} else if (e.target.classList.contains('dontKnowBtn')) {
|
| 557 |
+
markWordAsKnown(false);
|
| 558 |
+
}
|
| 559 |
+
});
|
| 560 |
}
|
| 561 |
|
| 562 |
// Add a new word to vocabulary
|
|
|
|
| 601 |
|
| 602 |
// Clear all words
|
| 603 |
function clearWords() {
|
| 604 |
+
if (confirm('Are you sure you want to clear all words? This will reset to default vocabulary.')) {
|
| 605 |
+
vocabulary = [...defaultVocabulary];
|
| 606 |
knownWords = [];
|
| 607 |
saveVocabulary();
|
| 608 |
updateWordList();
|
|
|
|
| 693 |
}
|
| 694 |
|
| 695 |
wordList.innerHTML = '';
|
| 696 |
+
|
| 697 |
+
// Group words by first letter for better organization
|
| 698 |
+
const groupedWords = vocabulary.reduce((groups, word) => {
|
| 699 |
+
const firstLetter = word.english.charAt(0).toUpperCase();
|
| 700 |
+
if (!groups[firstLetter]) {
|
| 701 |
+
groups[firstLetter] = [];
|
| 702 |
+
}
|
| 703 |
+
groups[firstLetter].push(word);
|
| 704 |
+
return groups;
|
| 705 |
+
}, {});
|
| 706 |
+
|
| 707 |
+
// Sort letters alphabetically
|
| 708 |
+
const sortedLetters = Object.keys(groupedWords).sort();
|
| 709 |
+
|
| 710 |
+
// Display words by letter groups
|
| 711 |
+
sortedLetters.forEach(letter => {
|
| 712 |
+
const letterGroup = document.createElement('div');
|
| 713 |
+
letterGroup.className = 'mb-4';
|
| 714 |
|
| 715 |
+
const letterHeader = document.createElement('div');
|
| 716 |
+
letterHeader.className = 'word-category px-3 py-2 mb-2 font-medium text-indigo-800';
|
| 717 |
+
letterHeader.textContent = letter;
|
| 718 |
|
| 719 |
+
letterGroup.appendChild(letterHeader);
|
| 720 |
+
|
| 721 |
+
groupedWords[letter].forEach((word, index) => {
|
| 722 |
+
const isKnown = knownWords.includes(word.english);
|
| 723 |
+
|
| 724 |
+
const wordEl = document.createElement('div');
|
| 725 |
+
wordEl.className = `flex justify-between items-center p-2 mb-1 rounded-lg ${isKnown ? 'bg-green-50' : 'bg-white'} border ${isKnown ? 'border-green-200' : 'border-gray-200'}`;
|
| 726 |
+
|
| 727 |
+
wordEl.innerHTML = `
|
| 728 |
+
<div class="flex-1">
|
| 729 |
+
<div class="font-medium text-gray-800">${word.english}</div>
|
| 730 |
+
<div class="text-sm text-gray-600">${word.vietnamese}</div>
|
| 731 |
+
${word.example ? `<div class="text-xs text-gray-500 italic mt-1">"${word.example}"</div>` : ''}
|
| 732 |
+
</div>
|
| 733 |
+
<div class="flex space-x-1">
|
| 734 |
+
<button class="know-toggle px-2 py-1 text-xs rounded ${isKnown ? 'bg-green-100 text-green-800' : 'bg-gray-100 text-gray-800'}" data-word="${word.english}">
|
| 735 |
+
<i class="fas ${isKnown ? 'fa-check-circle' : 'fa-question-circle'} mr-1"></i> ${isKnown ? 'Known' : 'Learning'}
|
| 736 |
+
</button>
|
| 737 |
+
${!defaultVocabulary.some(w => w.english === word.english) ?
|
| 738 |
+
`<button class="delete-word px-2 py-1 text-xs bg-red-100 text-red-800 rounded" data-index="${vocabulary.findIndex(w => w.english === word.english)}">
|
| 739 |
+
<i class="fas fa-trash-alt"></i>
|
| 740 |
+
</button>` : ''}
|
| 741 |
+
</div>
|
| 742 |
+
`;
|
| 743 |
+
|
| 744 |
+
letterGroup.appendChild(wordEl);
|
| 745 |
+
});
|
| 746 |
|
| 747 |
+
wordList.appendChild(letterGroup);
|
| 748 |
});
|
| 749 |
|
| 750 |
// Add event listeners for dynamically created buttons
|
|
|
|
| 776 |
// Delete a word from vocabulary
|
| 777 |
function deleteWord(e) {
|
| 778 |
const index = parseInt(e.target.closest('button').getAttribute('data-index'));
|
| 779 |
+
if (index < 0 || index >= vocabulary.length) return;
|
| 780 |
+
|
| 781 |
+
// Don't allow deleting default words
|
| 782 |
+
if (defaultVocabulary.some(w => w.english === vocabulary[index].english)) {
|
| 783 |
+
alert('Default words cannot be deleted. Clear all to reset.');
|
| 784 |
+
return;
|
| 785 |
+
}
|
| 786 |
+
|
| 787 |
vocabulary.splice(index, 1);
|
| 788 |
|
| 789 |
// Remove from known words if it was there
|
|
|
|
| 870 |
flashcard.classList.toggle('flipped');
|
| 871 |
}
|
| 872 |
|
| 873 |
+
// Mark word as known or not known
|
| 874 |
+
function markWordAsKnown(isKnown) {
|
| 875 |
+
const currentWord = vocabulary[currentFlashcardIndex].english;
|
| 876 |
+
const index = knownWords.indexOf(currentWord);
|
| 877 |
+
|
| 878 |
+
if (isKnown && index === -1) {
|
| 879 |
+
knownWords.push(currentWord);
|
| 880 |
+
} else if (!isKnown && index !== -1) {
|
| 881 |
+
knownWords.splice(index, 1);
|
| 882 |
+
}
|
| 883 |
+
|
| 884 |
+
saveVocabulary();
|
| 885 |
+
updateProgress();
|
| 886 |
+
|
| 887 |
+
// Move to next card automatically
|
| 888 |
+
if (currentFlashcardIndex < vocabulary.length - 1) {
|
| 889 |
+
currentFlashcardIndex++;
|
| 890 |
+
updateFlashcard();
|
| 891 |
+
}
|
| 892 |
+
}
|
| 893 |
+
|
| 894 |
// Show previous flashcard
|
| 895 |
function showPreviousCard() {
|
| 896 |
if (currentFlashcardIndex > 0) {
|
prompts.txt
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cập nhật thêm 50 từ tiếng anh thông dụng và nghĩa tiếng việt
|
| 2 |
+
50 từ mới thêm không tương tác được, làm lại
|