No Words Found
- Either this dictionary has not yet been started, or something prevented words from downloading.
import md from 'marked'; import { removeTags, slugify } from '../../helpers'; import { getWordsStats, wordExists } from '../utilities'; import { getMatchingSearchWords, highlightSearchTerm, getSearchFilters, getSearchTerm } from '../search'; import { showSection } from '../displayToggles'; import { setupSearchFilters, setupInfoModal } from './setupListeners'; export function renderAll() { renderDictionaryDetails(); renderPartsOfSpeech(); renderWords(); } export function renderDictionaryDetails() { renderName(); const tabs = document.querySelectorAll('#detailsSection nav li'); const shownTab = Array.from(tabs).find(tab => tab.classList.contains('active')); if (shownTab) { const tabName = shownTab.innerText.toLowerCase(); showSection(tabName); } } export function renderName() { const dictionaryName = removeTags(window.currentDictionary.name) + ' ' + removeTags(window.currentDictionary.specification); document.getElementById('dictionaryName').innerHTML = dictionaryName; } export function renderDescription() { const descriptionHTML = md(removeTags(window.currentDictionary.description)); document.getElementById('detailsPanel').innerHTML = '
Parts of Speech: ${partsOfSpeech.map(partOfSpeech => '' + partOfSpeech + '').join(' ')}
`; const alphabeticalOrderHTML = `Alphabetical Order: ${ (alphabeticalOrder.length > 0 ? alphabeticalOrder : ['English Alphabet']).map(letter => `${letter}`).join(' ') }
`; const generalHTML = `Consonants: ${consonants.map(letter => `${letter}`).join(' ')}
`; const vowelHTML = `Vowels: ${vowels.map(letter => `${letter}`).join(' ')}
`; const blendHTML = blends.length > 0 ? `Polyphthongs / Blends: ${blends.map(letter => `${letter}`).join(' ')}
` : ''; const phonologyHTML = `Onset: ${onset.map(letter => `${letter}`).join(' ')}
`; const nucleusHTML = `Nucleus: ${nucleus.map(letter => `${letter}`).join(' ')}
`; const codaHTML = `Coda: ${coda.map(letter => `${letter}`).join(' ')}
`; const exceptionsHTML = exceptions.trim().length > 0 ? 'Exceptions:
Notes:
Notes:
Number of Words
${wordStats.numberOfWords.map(stat => `${stat.name}${stat.value}`).join(' ')}
Word Length
Shortest${wordStats.wordLength.shortest}
Longest${wordStats.wordLength.longest}
Average${wordStats.wordLength.average}
Letter Distribution
${wordStats.letterDistribution.map(stat => `${stat.letter}${stat.percentage.toFixed(2)}`).join(' ')}
${wordStats.totalLetters} Total Letters
`; detailsPanel.innerHTML = numberOfWordsHTML + wordLengthHTML + letterDistributionHTML + totalLettersHTML; } export function renderPartsOfSpeech(onlyOptions = false) { let optionsHTML = '', searchHTML = ''; window.currentDictionary.partsOfSpeech.forEach(partOfSpeech => { partOfSpeech = removeTags(partOfSpeech); optionsHTML += ``; searchHTML += ``; }); searchHTML += `Check All Uncheck All`; Array.from(document.getElementsByClassName('part-of-speech-select')).forEach(select => { const selectedValue = select.value; select.innerHTML = optionsHTML; select.value = selectedValue; }); if (!onlyOptions) { document.getElementById('searchPartsOfSpeech').innerHTML = searchHTML; } setupSearchFilters(); } export function renderWords() { let wordsHTML = ''; let words = false; if (window.currentDictionary.words.length === 0) { wordsHTML = `