Download index.html from Djibson12/https-huggingface-co-djibson12: direct link, hf CLI and curl.
- Browser
- Download file 29.9 kB
-
https://huggingface.co/spaces/Djibson12/https-huggingface-co-djibson12/resolve/main/index.html
- Command line
-
hf download hf://spaces/Djibson12/https-huggingface-co-djibson12/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Djibson12/https-huggingface-co-djibson12/resolve/main/index.html
29.9 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>English-Wolof Dictionary</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap'); | |
| body { | |
| font-family: 'Poppins', sans-serif; | |
| background-color: #f8fafc; | |
| } | |
| .wolof-bg { | |
| background: linear-gradient(135deg, #1282A2 0%, #034078 100%); | |
| } | |
| .word-card { | |
| transition: all 0.3s ease; | |
| box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); | |
| } | |
| .word-card:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); | |
| } | |
| .type-badge { | |
| font-size: 0.75rem; | |
| padding: 0.25rem 0.5rem; | |
| border-radius: 9999px; | |
| } | |
| .noun { | |
| background-color: #3B82F6; | |
| color: white; | |
| } | |
| .verb { | |
| background-color: #10B981; | |
| color: white; | |
| } | |
| .adjective { | |
| background-color: #F59E0B; | |
| color: white; | |
| } | |
| .adverb { | |
| background-color: #8B5CF6; | |
| color: white; | |
| } | |
| .phrase { | |
| background-color: #EC4899; | |
| color: white; | |
| } | |
| .search-input:focus { | |
| outline: none; | |
| box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5); | |
| } | |
| .fade-in { | |
| animation: fadeIn 0.5s ease-in-out; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; transform: translateY(10px); } | |
| to { opacity: 1; transform: translateY(0); } | |
| } | |
| .wolof-text { | |
| color: #034078; | |
| font-weight: 600; | |
| } | |
| /* Modal styles */ | |
| .modal { | |
| display: none; | |
| position: fixed; | |
| z-index: 50; | |
| left: 0; | |
| top: 0; | |
| width: 100%; | |
| height: 100%; | |
| overflow: auto; | |
| background-color: rgba(0,0,0,0.4); | |
| } | |
| .modal-content { | |
| background-color: #fefefe; | |
| margin: 10% auto; | |
| padding: 20px; | |
| border: 1px solid #888; | |
| width: 90%; | |
| max-width: 500px; | |
| border-radius: 8px; | |
| animation: modalopen 0.3s; | |
| } | |
| @keyframes modalopen { | |
| from {opacity: 0; transform: translateY(-20px)} | |
| to {opacity: 1; transform: translateY(0)} | |
| } | |
| .close { | |
| color: #aaa; | |
| float: right; | |
| font-size: 28px; | |
| font-weight: bold; | |
| cursor: pointer; | |
| } | |
| .close:hover { | |
| color: black; | |
| } | |
| </style> | |
| </head> | |
| <body class="min-h-screen"> | |
| <div class="wolof-bg text-white py-6 px-4 shadow-md"> | |
| <div class="container mx-auto"> | |
| <div class="flex flex-col md:flex-row justify-between items-center"> | |
| <div class="flex items-center mb-4 md:mb-0"> | |
| <i class="fas fa-book-open text-3xl mr-3"></i> | |
| <h1 class="text-2xl md:text-3xl font-bold">English-Wolof Dictionary</h1> | |
| </div> | |
| <div class="flex items-center space-x-4"> | |
| <div class="relative w-full md:w-64"> | |
| <input type="text" id="searchInput" placeholder="Search word..." | |
| class="w-full py-2 px-4 pr-10 rounded-full text-gray-800 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <button id="searchBtn" class="absolute right-0 top-0 mt-2 mr-4 text-gray-600 hover:text-blue-500"> | |
| <i class="fas fa-search"></i> | |
| </button> | |
| </div> | |
| <button id="addWordBtn" class="bg-white text-blue-600 hover:bg-blue-50 px-4 py-2 rounded-full font-medium flex items-center"> | |
| <i class="fas fa-plus mr-2"></i> Add Word | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="container mx-auto px-4 py-8"> | |
| <div class="flex flex-col md:flex-row gap-6"> | |
| <!-- Main Content --> | |
| <div class="w-full md:w-3/4"> | |
| <div class="bg-white rounded-lg shadow-md p-6 mb-6"> | |
| <h2 class="text-xl font-semibold mb-4 text-gray-800">Welcome to English-Wolof Dictionary</h2> | |
| <p class="text-gray-600 mb-4"> | |
| This dictionary helps you learn and translate between English and Wolof, the most widely spoken language in Senegal. | |
| You can search for words, add new words, and hear pronunciations. | |
| </p> | |
| <div class="flex flex-wrap gap-2 mb-4"> | |
| <span class="type-badge noun">Noun</span> | |
| <span class="type-badge verb">Verb</span> | |
| <span class="type-badge adjective">Adjective</span> | |
| <span class="type-badge adverb">Adverb</span> | |
| <span class="type-badge phrase">Phrase</span> | |
| </div> | |
| <div class="bg-blue-50 border-l-4 border-blue-500 p-4"> | |
| <p class="text-blue-700"> | |
| <i class="fas fa-info-circle mr-2"></i> | |
| Wolof is written with the Latin alphabet but has some unique characters like ñ, ŋ, and ñ. | |
| </p> | |
| </div> | |
| </div> | |
| <!-- Search Results --> | |
| <div id="searchResults" class="space-y-4"> | |
| <!-- Results will be displayed here --> | |
| </div> | |
| <!-- Popular Words --> | |
| <div class="mt-8"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="text-lg font-semibold text-gray-800">Common Wolof Words</h3> | |
| <button id="showAllWords" class="text-blue-500 hover:text-blue-700 text-sm flex items-center"> | |
| <i class="fas fa-list mr-1"></i> Show All Words | |
| </button> | |
| </div> | |
| <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4" id="popularWords"> | |
| <!-- Popular words will be loaded here --> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Sidebar --> | |
| <div class="w-full md:w-1/4"> | |
| <div class="bg-white rounded-lg shadow-md p-6 mb-6"> | |
| <h3 class="font-semibold text-lg mb-4 text-gray-800">Quick Facts</h3> | |
| <div class="space-y-4"> | |
| <div> | |
| <h4 class="font-medium text-blue-600">Wolof Speakers</h4> | |
| <p class="text-sm text-gray-600">~10 million native speakers</p> | |
| </div> | |
| <div> | |
| <h4 class="font-medium text-blue-600">Countries</h4> | |
| <p class="text-sm text-gray-600">Senegal, Gambia, Mauritania</p> | |
| </div> | |
| <div> | |
| <h4 class="font-medium text-blue-600">Language Family</h4> | |
| <p class="text-sm text-gray-600">Niger-Congo > Atlantic > Senegambian</p> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-white rounded-lg shadow-md p-6"> | |
| <h3 class="font-semibold text-lg mb-4 text-gray-800">Common Phrases</h3> | |
| <div class="space-y-3"> | |
| <div> | |
| <p class="font-medium">How are you?</p> | |
| <p class="wolof-text text-sm">Nanga def?</p> | |
| </div> | |
| <div> | |
| <p class="font-medium">I'm fine</p> | |
| <p class="wolof-text text-sm">Mangi fi rekk</p> | |
| </div> | |
| <div> | |
| <p class="font-medium">What's your name?</p> | |
| <p class="wolof-text text-sm">Naka nga tudd?</p> | |
| </div> | |
| <div> | |
| <p class="font-medium">My name is...</p> | |
| <p class="wolof-text text-sm">Maa ngi tudd...</p> | |
| </div> | |
| <div> | |
| <p class="font-medium">Goodbye</p> | |
| <p class="wolof-text text-sm">Ba beneen</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Add Word Modal --> | |
| <div id="addWordModal" class="modal"> | |
| <div class="modal-content"> | |
| <span class="close">×</span> | |
| <h2 class="text-xl font-bold mb-4">Add New Word</h2> | |
| <form id="addWordForm"> | |
| <div class="mb-4"> | |
| <label for="englishWord" class="block text-gray-700 mb-2">English Word</label> | |
| <input type="text" id="englishWord" required class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| </div> | |
| <div class="mb-4"> | |
| <label for="wolofWord" class="block text-gray-700 mb-2">Wolof Translation</label> | |
| <input type="text" id="wolofWord" required class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| </div> | |
| <div class="mb-4"> | |
| <label for="wordType" class="block text-gray-700 mb-2">Word Type</label> | |
| <select id="wordType" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <option value="noun">Noun</option> | |
| <option value="verb">Verb</option> | |
| <option value="adjective">Adjective</option> | |
| <option value="adverb">Adverb</option> | |
| <option value="phrase">Phrase</option> | |
| </select> | |
| </div> | |
| <div class="mb-4"> | |
| <label for="pronunciation" class="block text-gray-700 mb-2">Pronunciation Guide</label> | |
| <input type="text" id="pronunciation" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| </div> | |
| <div class="mb-4"> | |
| <label for="examples" class="block text-gray-700 mb-2">Example Sentences (one per line)</label> | |
| <textarea id="examples" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea> | |
| </div> | |
| <div class="flex justify-end space-x-3"> | |
| <button type="button" id="cancelAddWord" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-100">Cancel</button> | |
| <button type="submit" class="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600">Add Word</button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| <footer class="wolof-bg text-white py-6 mt-12"> | |
| <div class="container mx-auto px-4"> | |
| <div class="flex flex-col md:flex-row justify-between items-center"> | |
| <div class="mb-4 md:mb-0"> | |
| <h3 class="text-xl font-bold mb-2">English-Wolof Dictionary</h3> | |
| <p class="text-blue-100">Learn the beautiful Wolof language</p> | |
| </div> | |
| <div class="flex space-x-4"> | |
| <a href="#" class="text-white hover:text-blue-200"> | |
| <i class="fab fa-facebook-f"></i> | |
| </a> | |
| <a href="#" class="text-white hover:text-blue-200"> | |
| <i class="fab fa-twitter"></i> | |
| </a> | |
| <a href="#" class="text-white hover:text-blue-200"> | |
| <i class="fab fa-instagram"></i> | |
| </a> | |
| </div> | |
| </div> | |
| <div class="border-t border-blue-400 mt-6 pt-6 text-sm text-center text-blue-100"> | |
| <p>© 2023 English-Wolof Dictionary. All rights reserved.</p> | |
| </div> | |
| </div> | |
| </footer> | |
| <script> | |
| // Dictionary data - loaded from localStorage or initialized with default words | |
| let dictionary = JSON.parse(localStorage.getItem('wolofDictionary')) || [ | |
| { | |
| english: "hello", | |
| wolof: "Nanga def", | |
| type: "phrase", | |
| pronunciation: "Nahn-gah def", | |
| examples: [ | |
| "Hello, how are you? - Nanga def, na nga def?", | |
| "Hello my friend - Nanga def samay xarit" | |
| ] | |
| }, | |
| { | |
| english: "thank you", | |
| wolof: "Jërëjëf", | |
| type: "phrase", | |
| pronunciation: "Jeh-reh-jef", | |
| examples: [ | |
| "Thank you very much - Jërëjëf bu baax", | |
| "I thank you - Damay jërëjëf" | |
| ] | |
| }, | |
| { | |
| english: "water", | |
| wolof: "Ndox", | |
| type: "noun", | |
| pronunciation: "Ndoh", | |
| examples: [ | |
| "I need water - Damay soxla ndox", | |
| "The water is cold - Ndox mi di nawn" | |
| ] | |
| }, | |
| { | |
| english: "food", | |
| wolof: "Lekk", | |
| type: "noun", | |
| pronunciation: "Leck", | |
| examples: [ | |
| "The food is delicious - Lekk mi leex na", | |
| "I want food - Damay bëgg lekk" | |
| ] | |
| }, | |
| { | |
| english: "good", | |
| wolof: "Baax", | |
| type: "adjective", | |
| pronunciation: "Bahkh", | |
| examples: [ | |
| "Good morning - Suba ak siwil", | |
| "That's very good - Dafay baax lool" | |
| ] | |
| }, | |
| { | |
| english: "go", | |
| wolof: "Dem", | |
| type: "verb", | |
| pronunciation: "Dem", | |
| examples: [ | |
| "I go to school - Damay dem ca daara bi", | |
| "Let's go! - Annà dem!" | |
| ] | |
| }, | |
| { | |
| english: "house", | |
| wolof: "Kër", | |
| type: "noun", | |
| pronunciation: "Kehr", | |
| examples: [ | |
| "My house is big - Kër ga ma am dafa metti", | |
| "We're going home - Nunuy dem kër" | |
| ] | |
| }, | |
| { | |
| english: "love", | |
| wolof: "Nopalu", | |
| type: "verb", | |
| pronunciation: "Noh-pah-loo", | |
| examples: [ | |
| "I love you - Damay la nopalu", | |
| "Love is beautiful - Nopalu dafa rafet" | |
| ] | |
| }, | |
| { | |
| english: "money", | |
| wolof: "Xaalis", | |
| type: "noun", | |
| pronunciation: "Khah-lis", | |
| examples: [ | |
| "I don't have money - Amuma xaalis", | |
| "Money is important - Xaalis moo gën a am solo" | |
| ] | |
| }, | |
| { | |
| english: "work", | |
| wolof: "Jëf", | |
| type: "noun", | |
| pronunciation: "Jef", | |
| examples: [ | |
| "I'm going to work - Damay dem jëf", | |
| "The work is hard - Jëf ji dafa am solo" | |
| ] | |
| } | |
| ]; | |
| // Save dictionary to localStorage | |
| function saveDictionary() { | |
| localStorage.setItem('wolofDictionary', JSON.stringify(dictionary)); | |
| } | |
| // DOM elements | |
| const searchInput = document.getElementById('searchInput'); | |
| const searchBtn = document.getElementById('searchBtn'); | |
| const searchResults = document.getElementById('searchResults'); | |
| const popularWordsContainer = document.getElementById('popularWords'); | |
| const showAllWordsBtn = document.getElementById('showAllWords'); | |
| const addWordBtn = document.getElementById('addWordBtn'); | |
| const addWordModal = document.getElementById('addWordModal'); | |
| const closeModal = document.getElementsByClassName('close')[0]; | |
| const cancelAddWord = document.getElementById('cancelAddWord'); | |
| const addWordForm = document.getElementById('addWordForm'); | |
| // Search function | |
| function searchDictionary(query) { | |
| if (!query) return []; | |
| return dictionary.filter(item => | |
| item.english.toLowerCase().includes(query.toLowerCase()) || | |
| item.wolof.toLowerCase().includes(query.toLowerCase()) | |
| ); | |
| } | |
| // Display results | |
| function displayResults(results) { | |
| searchResults.innerHTML = ''; | |
| if (results.length === 0) { | |
| searchResults.innerHTML = ` | |
| <div class="bg-white rounded-lg shadow-md p-6 text-center"> | |
| <i class="fas fa-search text-4xl text-gray-400 mb-4"></i> | |
| <h3 class="text-xl font-semibold text-gray-700">No results found</h3> | |
| <p class="text-gray-500 mt-2">Try searching for another word</p> | |
| </div> | |
| `; | |
| return; | |
| } | |
| results.forEach(result => { | |
| const resultElement = document.createElement('div'); | |
| resultElement.className = 'word-card fade-in bg-white rounded-lg shadow-md p-6'; | |
| resultElement.innerHTML = ` | |
| <div class="flex justify-between items-start mb-4"> | |
| <div> | |
| <h3 class="text-2xl font-bold text-gray-800">${capitalizeFirstLetter(result.english)}</h3> | |
| <p class="wolof-text text-xl mt-1">${result.wolof}</p> | |
| </div> | |
| <span class="type-badge ${result.type}">${capitalizeFirstLetter(result.type)}</span> | |
| </div> | |
| ${result.pronunciation ? ` | |
| <div class="mb-4"> | |
| <p class="text-gray-600"><span class="font-medium">Pronunciation:</span> ${result.pronunciation}</p> | |
| </div>` : ''} | |
| ${result.examples && result.examples.length > 0 ? ` | |
| <div> | |
| <h4 class="font-medium text-gray-700 mb-2">Examples:</h4> | |
| <ul class="list-disc list-inside space-y-2 text-gray-600"> | |
| ${result.examples.map(example => `<li>${example}</li>`).join('')} | |
| </ul> | |
| </div>` : ''} | |
| <div class="mt-4 flex justify-between items-center"> | |
| <button class="text-blue-500 hover:text-blue-700 flex items-center" onclick="speakWord('${result.wolof}')"> | |
| <i class="fas fa-volume-up mr-2"></i> Pronounce | |
| </button> | |
| <button class="text-gray-500 hover:text-gray-700 text-sm" onclick="saveWord('${result.english}')"> | |
| <i class="fas fa-bookmark mr-1"></i> Save | |
| </button> | |
| </div> | |
| `; | |
| searchResults.appendChild(resultElement); | |
| }); | |
| } | |
| // Display popular words | |
| function displayPopularWords() { | |
| popularWordsContainer.innerHTML = ''; | |
| // Show first 6 words as popular words | |
| const popularWords = dictionary.slice(0, 6); | |
| popularWords.forEach(word => { | |
| const wordElement = document.createElement('div'); | |
| wordElement.className = 'word-card bg-white rounded-lg p-4 hover:shadow-lg cursor-pointer'; | |
| wordElement.onclick = () => searchWord(word.english); | |
| wordElement.innerHTML = ` | |
| <div class="flex justify-between items-start"> | |
| <h4 class="font-bold text-lg">${capitalizeFirstLetter(word.english)}</h4> | |
| <span class="type-badge ${word.type}">${capitalizeFirstLetter(word.type)}</span> | |
| </div> | |
| <p class="wolof-text mt-2">${word.wolof}</p> | |
| <button class="mt-2 text-blue-500 hover:text-blue-700 text-sm flex items-center" onclick="event.stopPropagation(); speakWord('${word.wolof}')"> | |
| <i class="fas fa-volume-up mr-1"></i> Pronounce | |
| </button> | |
| `; | |
| popularWordsContainer.appendChild(wordElement); | |
| }); | |
| } | |
| // Display all words | |
| function displayAllWords() { | |
| searchResults.innerHTML = ''; | |
| if (dictionary.length === 0) { | |
| searchResults.innerHTML = ` | |
| <div class="bg-white rounded-lg shadow-md p-6 text-center"> | |
| <i class="fas fa-book text-4xl text-gray-400 mb-4"></i> | |
| <h3 class="text-xl font-semibold text-gray-700">No words in dictionary</h3> | |
| <p class="text-gray-500 mt-2">Add some words to get started</p> | |
| </div> | |
| `; | |
| return; | |
| } | |
| // Group words by first letter | |
| const groupedWords = {}; | |
| dictionary.forEach(word => { | |
| const firstLetter = word.english.charAt(0).toUpperCase(); | |
| if (!groupedWords[firstLetter]) { | |
| groupedWords[firstLetter] = []; | |
| } | |
| groupedWords[firstLetter].push(word); | |
| }); | |
| // Sort letters alphabetically | |
| const sortedLetters = Object.keys(groupedWords).sort(); | |
| // Create sections for each letter | |
| sortedLetters.forEach(letter => { | |
| const section = document.createElement('div'); | |
| section.className = 'mb-8'; | |
| section.innerHTML = ` | |
| <h3 class="text-xl font-bold mb-4 text-gray-800 border-b pb-2">${letter}</h3> | |
| <div class="grid grid-cols-1 sm:grid-cols-2 gap-4" id="letter-${letter}"> | |
| <!-- Words for this letter will be added here --> | |
| </div> | |
| `; | |
| searchResults.appendChild(section); | |
| const wordsContainer = document.getElementById(`letter-${letter}`); | |
| groupedWords[letter].forEach(word => { | |
| const wordElement = document.createElement('div'); | |
| wordElement.className = 'word-card bg-white rounded-lg p-4 hover:shadow-lg cursor-pointer'; | |
| wordElement.onclick = () => searchWord(word.english); | |
| wordElement.innerHTML = ` | |
| <div class="flex justify-between items-start"> | |
| <h4 class="font-bold text-lg">${capitalizeFirstLetter(word.english)}</h4> | |
| <span class="type-badge ${word.type}">${capitalizeFirstLetter(word.type)}</span> | |
| </div> | |
| <p class="wolof-text mt-2">${word.wolof}</p> | |
| <button class="mt-2 text-blue-500 hover:text-blue-700 text-sm flex items-center" onclick="event.stopPropagation(); speakWord('${word.wolof}')"> | |
| <i class="fas fa-volume-up mr-1"></i> Pronounce | |
| </button> | |
| `; | |
| wordsContainer.appendChild(wordElement); | |
| }); | |
| }); | |
| } | |
| // Helper functions | |
| function capitalizeFirstLetter(string) { | |
| return string.charAt(0).toUpperCase() + string.slice(1); | |
| } | |
| function speakWord(word) { | |
| const utterance = new SpeechSynthesisUtterance(word); | |
| utterance.lang = 'fr-FR'; // Using French as closest available for Wolof pronunciation | |
| speechSynthesis.speak(utterance); | |
| } | |
| function saveWord(word) { | |
| alert(`"${capitalizeFirstLetter(word)}" has been saved to your favorites!`); | |
| // In a real app, you would save this to localStorage or a database | |
| } | |
| function searchWord(word) { | |
| searchInput.value = word; | |
| performSearch(); | |
| } | |
| function performSearch() { | |
| const query = searchInput.value.trim(); | |
| if (query.length === 0) { | |
| searchResults.innerHTML = ` | |
| <div class="bg-white rounded-lg shadow-md p-6 text-center"> | |
| <i class="fas fa-language text-4xl text-blue-500 mb-4"></i> | |
| <h3 class="text-xl font-semibold text-gray-700">Search for English or Wolof words</h3> | |
| <p class="text-gray-500 mt-2">Type a word in the search box above</p> | |
| </div> | |
| `; | |
| return; | |
| } | |
| const results = searchDictionary(query); | |
| displayResults(results); | |
| } | |
| // Add new word | |
| function addNewWord(event) { | |
| event.preventDefault(); | |
| const englishWord = document.getElementById('englishWord').value.trim(); | |
| const wolofWord = document.getElementById('wolofWord').value.trim(); | |
| const wordType = document.getElementById('wordType').value; | |
| const pronunciation = document.getElementById('pronunciation').value.trim(); | |
| const examplesText = document.getElementById('examples').value.trim(); | |
| // Split examples by new lines and filter out empty lines | |
| const examples = examplesText.split('\n').filter(line => line.trim().length > 0); | |
| // Create new word object | |
| const newWord = { | |
| english: englishWord.toLowerCase(), | |
| wolof: wolofWord, | |
| type: wordType, | |
| pronunciation: pronunciation || undefined, | |
| examples: examples.length > 0 ? examples : undefined | |
| }; | |
| // Add to dictionary | |
| dictionary.unshift(newWord); // Add at beginning so it shows up in popular words | |
| saveDictionary(); | |
| // Close modal and reset form | |
| addWordModal.style.display = 'none'; | |
| addWordForm.reset(); | |
| // Update display | |
| displayPopularWords(); | |
| performSearch(); | |
| // Show success message | |
| alert(`"${capitalizeFirstLetter(englishWord)}" has been added to the dictionary!`); | |
| } | |
| // Event listeners | |
| searchBtn.addEventListener('click', performSearch); | |
| searchInput.addEventListener('keyup', (e) => { | |
| if (e.key === 'Enter') { | |
| performSearch(); | |
| } | |
| }); | |
| showAllWordsBtn.addEventListener('click', displayAllWords); | |
| // Modal open/close | |
| addWordBtn.addEventListener('click', () => { | |
| addWordModal.style.display = 'block'; | |
| }); | |
| closeModal.addEventListener('click', () => { | |
| addWordModal.style.display = 'none'; | |
| }); | |
| cancelAddWord.addEventListener('click', () => { | |
| addWordModal.style.display = 'none'; | |
| }); | |
| window.addEventListener('click', (event) => { | |
| if (event.target === addWordModal) { | |
| addWordModal.style.display = 'none'; | |
| } | |
| }); | |
| addWordForm.addEventListener('submit', addNewWord); | |
| // Initialize | |
| displayPopularWords(); | |
| performSearch(); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Djibson12/https-huggingface-co-djibson12" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |