diff options
Diffstat (limited to 'ext/js')
| -rw-r--r-- | ext/js/display/display-generator.js | 64 | ||||
| -rw-r--r-- | ext/js/display/display.js | 4 | ||||
| -rw-r--r-- | ext/js/language/dictionary-database.js | 4 | ||||
| -rw-r--r-- | ext/js/language/translator.js | 8 | 
4 files changed, 40 insertions, 40 deletions
| diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js index 32699ec7..61c93b4a 100644 --- a/ext/js/display/display-generator.js +++ b/ext/js/display/display-generator.js @@ -53,12 +53,12 @@ class DisplayGenerator {      createTermEntry(dictionaryEntry) {          const node = this._templates.instantiate('term-entry'); -        const headwordsContainer = node.querySelector('.expression-list'); +        const headwordsContainer = node.querySelector('.headword-list');          const inflectionsContainer = node.querySelector('.inflection-list');          const pitchesContainer = node.querySelector('.pitch-accent-group-list');          const frequencyGroupListContainer = node.querySelector('.frequency-group-list');          const definitionsContainer = node.querySelector('.definition-list'); -        const termTagsContainer = node.querySelector('.expression-list-tag-list'); +        const headwordTagsContainer = node.querySelector('.headword-list-tag-list');          const {headwords, type, inflections, definitions, frequencies, pronunciations} = dictionaryEntry;          const pitches = DictionaryDataUtil.getPitchAccentInfos(dictionaryEntry); @@ -74,11 +74,11 @@ class DisplayGenerator {          }          node.dataset.format = type; -        node.dataset.expressionCount = `${headwords.length}`; +        node.dataset.headwordCount = `${headwords.length}`;          node.dataset.definitionCount = `${definitions.length}`;          node.dataset.pitchAccentDictionaryCount = `${pitches.length}`;          node.dataset.pitchAccentCount = `${pitchCount}`; -        node.dataset.uniqueExpressionCount = `${uniqueTerms.size}`; +        node.dataset.uniqueTermCount = `${uniqueTerms.size}`;          node.dataset.uniqueReadingCount = `${uniqueReadings.size}`;          node.dataset.frequencyCount = `${frequencies.length}`;          node.dataset.groupedFrequencyCount = `${groupedFrequencies.length}`; @@ -93,14 +93,14 @@ class DisplayGenerator {          this._appendMultiple(inflectionsContainer, this._createTermInflection.bind(this), inflections);          this._appendMultiple(frequencyGroupListContainer, this._createFrequencyGroup.bind(this), groupedFrequencies, false);          this._appendMultiple(pitchesContainer, this._createPitches.bind(this), pitches); -        this._appendMultiple(termTagsContainer, this._createTermTag.bind(this), termTags, headwords.length); +        this._appendMultiple(headwordTagsContainer, this._createTermTag.bind(this), termTags, headwords.length);          for (const term of uniqueTerms) { -            termTagsContainer.appendChild(this._createSearchTag(term)); +            headwordTagsContainer.appendChild(this._createSearchTag(term));          }          for (const reading of uniqueReadings) {              if (uniqueTerms.has(reading)) { continue; } -            termTagsContainer.appendChild(this._createSearchTag(reading)); +            headwordTagsContainer.appendChild(this._createSearchTag(reading));          }          // Add definitions @@ -132,7 +132,7 @@ class DisplayGenerator {          const glyphContainer = node.querySelector('.kanji-glyph');          const frequencyGroupListContainer = node.querySelector('.frequency-group-list');          const tagContainer = node.querySelector('.kanji-tag-list'); -        const definitionsContainer = node.querySelector('.kanji-glossary-list'); +        const definitionsContainer = node.querySelector('.kanji-gloss-list');          const chineseReadingsContainer = node.querySelector('.kanji-readings-chinese');          const japaneseReadingsContainer = node.querySelector('.kanji-readings-japanese');          const statisticsContainer = node.querySelector('.kanji-statistics'); @@ -188,7 +188,7 @@ class DisplayGenerator {              if (disambiguationHeadwords.length > 0 && disambiguationHeadwords.length < headwords.length) {                  const disambiguationContainer = node.querySelector('.tag-details-disambiguation-list'); -                const copyAttributes = ['totalExpressionCount', 'matchedExpressionCount', 'unmatchedExpressionCount']; +                const copyAttributes = ['totalHeadwordCount', 'matchedHeadwordCount', 'unmatchedHeadwordCount'];                  for (const attribute of copyAttributes) {                      const value = tagNode.dataset[attribute];                      if (typeof value === 'undefined') { continue; } @@ -242,10 +242,10 @@ class DisplayGenerator {          if (term) { searchQueries.push(term); }          if (reading) { searchQueries.push(reading); } -        const node = this._templates.instantiate('expression'); +        const node = this._templates.instantiate('headword'); -        const termContainer = node.querySelector('.expression-text'); -        const tagContainer = node.querySelector('.expression-tag-list'); +        const termContainer = node.querySelector('.headword-term'); +        const tagContainer = node.querySelector('.headword-tag-list');          node.dataset.readingIsSame = `${reading === term}`;          node.dataset.frequency = DictionaryDataUtil.getTermFrequency(tags); @@ -259,7 +259,7 @@ class DisplayGenerator {              node.dataset.wordClasses = wordClasses.join(' ');          } -        this._setTextContent(node.querySelector('.expression-reading'), reading); +        this._setTextContent(node.querySelector('.headword-reading'), reading);          this._appendFurigana(termContainer, term, reading, this._appendKanjiLinks.bind(this));          this._appendMultiple(tagContainer, this._createTag.bind(this), tags); @@ -284,7 +284,7 @@ class DisplayGenerator {          const tagListContainer = node.querySelector('.definition-tag-list');          const onlyListContainer = node.querySelector('.definition-disambiguation-list'); -        const entriesContainer = node.querySelector('.glossary-list'); +        const entriesContainer = node.querySelector('.gloss-list');          node.dataset.dictionary = dictionary; @@ -309,8 +309,8 @@ class DisplayGenerator {      }      _createTermDefinitionEntryText(text) { -        const node = this._templates.instantiate('glossary-item'); -        const container = node.querySelector('.glossary'); +        const node = this._templates.instantiate('gloss-item'); +        const container = node.querySelector('.gloss-content');          this._setMultilineTextContent(container, text);          return node;      } @@ -330,22 +330,22 @@ class DisplayGenerator {              width / height          ); -        const node = this._templates.instantiate('glossary-item-image'); +        const node = this._templates.instantiate('gloss-item-image');          node.dataset.path = path;          node.dataset.dictionary = dictionary;          node.dataset.imageLoadState = 'not-loaded'; -        const imageContainer = node.querySelector('.glossary-image-container'); +        const imageContainer = node.querySelector('.gloss-image-container');          imageContainer.style.width = `${usedWidth}em`;          if (typeof title === 'string') {              imageContainer.title = title;          } -        const aspectRatioSizer = node.querySelector('.glossary-image-aspect-ratio-sizer'); +        const aspectRatioSizer = node.querySelector('.gloss-image-aspect-ratio-sizer');          aspectRatioSizer.style.paddingTop = `${aspectRatio * 100.0}%`; -        const image = node.querySelector('img.glossary-image'); -        const imageLink = node.querySelector('.glossary-image-link'); +        const image = node.querySelector('img.gloss-image'); +        const imageLink = node.querySelector('.gloss-image-link');          image.dataset.pixelated = `${pixelated === true}`;          if (this._mediaLoader !== null) { @@ -358,7 +358,7 @@ class DisplayGenerator {          }          if (typeof description === 'string') { -            const container = node.querySelector('.glossary-image-description'); +            const container = node.querySelector('.gloss-image-description');              this._setMultilineTextContent(container, description);          } @@ -386,14 +386,14 @@ class DisplayGenerator {      _createKanjiLink(character) {          const node = document.createElement('a'); -        node.className = 'expression-kanji-link'; +        node.className = 'headword-kanji-link';          this._setTextContent(node, character, 'ja');          return node;      }      _createKanjiDefinition(text) { -        const node = this._templates.instantiate('kanji-glossary-item'); -        const container = node.querySelector('.kanji-glossary'); +        const node = this._templates.instantiate('kanji-gloss-item'); +        const container = node.querySelector('.kanji-gloss-content');          this._setMultilineTextContent(container, text);          return node;      } @@ -452,9 +452,9 @@ class DisplayGenerator {          const {tag, headwordIndices} = tagInfo;          const node = this._createTag(tag);          node.dataset.headwords = headwordIndices.join(' '); -        node.dataset.totalExpressionCount = `${totalHeadwordCount}`; -        node.dataset.matchedExpressionCount = `${headwordIndices.length}`; -        node.dataset.unmatchedExpressionCount = `${Math.max(0, totalHeadwordCount - headwordIndices.length)}`; +        node.dataset.totalHeadwordCount = `${totalHeadwordCount}`; +        node.dataset.matchedHeadwordCount = `${headwordIndices.length}`; +        node.dataset.unmatchedHeadwordCount = `${Math.max(0, totalHeadwordCount - headwordIndices.length)}`;          return node;      } @@ -549,7 +549,7 @@ class DisplayGenerator {          const templateName = 'pitch-accent-disambiguation';          for (const term of exclusiveTerms) {              const node = this._templates.instantiate(templateName); -            node.dataset.type = 'expression'; +            node.dataset.type = 'term';              this._setTextContent(node, term, 'ja');              container.appendChild(node);          } @@ -562,7 +562,7 @@ class DisplayGenerator {          }          container.dataset.count = `${exclusiveTerms.length + exclusiveReadings.length}`; -        container.dataset.expressionCount = `${exclusiveTerms.length}`; +        container.dataset.termCount = `${exclusiveTerms.length}`;          container.dataset.readingCount = `${exclusiveReadings.length}`;      } @@ -639,11 +639,11 @@ class DisplayGenerator {          const frequency = values.join(', '); -        this._setTextContent(node.querySelector('.frequency-disambiguation-expression'), term, 'ja'); +        this._setTextContent(node.querySelector('.frequency-disambiguation-term'), term, 'ja');          this._setTextContent(node.querySelector('.frequency-disambiguation-reading'), (reading !== null ? reading : ''), 'ja');          this._setTextContent(node.querySelector('.frequency-value'), frequency, 'ja'); -        node.dataset.expression = term; +        node.dataset.term = term;          node.dataset.reading = reading;          node.dataset.hasReading = `${reading !== null}`;          node.dataset.readingIsSame = `${reading === term}`; diff --git a/ext/js/display/display.js b/ext/js/display/display.js index ab3ec7e1..fcfa0244 100644 --- a/ext/js/display/display.js +++ b/ext/js/display/display.js @@ -46,7 +46,7 @@ class Display extends EventDispatcher {          this._japaneseUtil = japaneseUtil;          this._documentFocusController = documentFocusController;          this._hotkeyHandler = hotkeyHandler; -        this._container = document.querySelector('#definitions'); +        this._container = document.querySelector('#dictionary-entries');          this._dictionaryEntries = [];          this._dictionaryEntryNodes = [];          this._optionsContext = {depth: 0, url: window.location.href}; @@ -1705,7 +1705,7 @@ class Display extends EventDispatcher {          this._eventListeners.addEventListener(entry, 'click', this._onEntryClick.bind(this));          this._addMultipleEventListeners(entry, '.action-add-note', 'click', this._onNoteAdd.bind(this));          this._addMultipleEventListeners(entry, '.action-view-note', 'click', this._onNoteView.bind(this)); -        this._addMultipleEventListeners(entry, '.expression-kanji-link', 'click', this._onKanjiLookup.bind(this)); +        this._addMultipleEventListeners(entry, '.headword-kanji-link', 'click', this._onKanjiLookup.bind(this));          this._addMultipleEventListeners(entry, '.debug-log-link', 'click', this._onDebugLogClick.bind(this));          this._addMultipleEventListeners(entry, '.tag-label', 'click', this._onTagClick.bind(this));      } diff --git a/ext/js/language/dictionary-database.js b/ext/js/language/dictionary-database.js index 98f56986..6b235fb6 100644 --- a/ext/js/language/dictionary-database.js +++ b/ext/js/language/dictionary-database.js @@ -392,7 +392,7 @@ class DictionaryDatabase {              definitionTags: this._splitField(row.definitionTags || row.tags || ''),              termTags: this._splitField(row.termTags || ''),              rules: this._splitField(row.rules), -            glossary: row.glossary, +            definitions: row.glossary,              score: row.score,              dictionary: row.dictionary,              id: row.id, @@ -407,7 +407,7 @@ class DictionaryDatabase {              onyomi: this._splitField(row.onyomi),              kunyomi: this._splitField(row.kunyomi),              tags: this._splitField(row.tags), -            glossary: row.meanings, +            definitions: row.meanings,              stats: row.stats,              dictionary: row.dictionary          }; diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js index 68a55cf9..28634f9c 100644 --- a/ext/js/language/translator.js +++ b/ext/js/language/translator.js @@ -148,13 +148,13 @@ class Translator {          this._sortDatabaseEntriesByIndex(databaseEntries);          const dictionaryEntries = []; -        for (const {character, onyomi, kunyomi, tags, glossary, stats, dictionary} of databaseEntries) { +        for (const {character, onyomi, kunyomi, tags, definitions, stats, dictionary} of databaseEntries) {              const expandedStats = await this._expandKanjiStats(stats, dictionary);              const tagGroups = [];              if (tags.length > 0) { tagGroups.push(this._createTagGroup(dictionary, tags)); } -            const dictionaryEntry = this._createKanjiDictionaryEntry(character, dictionary, onyomi, kunyomi, tagGroups, expandedStats, glossary); +            const dictionaryEntry = this._createKanjiDictionaryEntry(character, dictionary, onyomi, kunyomi, tagGroups, expandedStats, definitions);              dictionaryEntries.push(dictionaryEntry);          } @@ -960,7 +960,7 @@ class Translator {      }      _createTermDictionaryEntryFromDatabaseEntry(databaseEntry, originalText, transformedText, deinflectedText, reasons, isPrimary, enabledDictionaryMap) { -        const {term, reading: rawReading, definitionTags, termTags, glossary, score, dictionary, id, sequence, rules} = databaseEntry; +        const {term, reading: rawReading, definitionTags, termTags, definitions, score, dictionary, id, sequence, rules} = databaseEntry;          const reading = (rawReading.length > 0 ? rawReading : term);          const {index: dictionaryIndex, priority: dictionaryPriority} = this._getDictionaryOrder(dictionary, enabledDictionaryMap);          const sourceTermExactMatchCount = (isPrimary && deinflectedText === term ? 1 : 0); @@ -984,7 +984,7 @@ class Translator {              sourceTermExactMatchCount,              maxTransformedTextLength,              [this._createTermHeadword(0, term, reading, [source], headwordTagGroups, rules)], -            [this._createTermDefinition(0, [0], dictionary, definitionTagGroups, glossary)] +            [this._createTermDefinition(0, [0], dictionary, definitionTagGroups, definitions)]          );      } |