From 3655e5a8204232fa85c35515edaa0b1b6da66e66 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 6 Nov 2016 19:14:43 -0800 Subject: [PATCH] Cleanup --- ext/bg/import.html | 2 +- ext/bg/js/dictionary.js | 22 +++++++++++----------- ext/bg/js/options-form.js | 8 ++++---- ext/bg/js/templates.js | 6 +++--- tmpl/dictionary.html | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ext/bg/import.html b/ext/bg/import.html index 7f30b491..c2e9682e 100644 --- a/ext/bg/import.html +++ b/ext/bg/import.html @@ -39,7 +39,7 @@

Please read the steps outlined below to get quickly get up and running with Yomichan. For complete documentation, - visit the official homepage. + visit the official homepage.

    diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js index 008bc483..fe0284c9 100644 --- a/ext/bg/js/dictionary.js +++ b/ext/bg/js/dictionary.js @@ -34,7 +34,7 @@ class Dictionary { terms: '++id, dictionary, expression, reading', kanji: '++, dictionary, character', entities: '++, dictionary', - dictionaries: '++, dictionary, version', + dictionaries: '++, title, version', meta: 'name, value', }); } @@ -144,16 +144,16 @@ class Dictionary { return Promise.reject('database not initialized'); } - const indexLoaded = (dictionary, version, entities, hasTerms, hasKanji) => { - return this.db.dictionaries.add({dictionary, version, hasTerms, hasKanji}).then(() => { + const indexLoaded = (title, version, entities, hasTerms, hasKanji) => { + return this.db.dictionaries.add({title, version, hasTerms, hasKanji}).then(() => { this.entities = entities || {}; const rows = []; for (const name in entities || {}) { rows.push({ - dictionary, name, - value: entities[name] + value: entities[name], + dictionary: title }); } @@ -161,15 +161,15 @@ class Dictionary { }); }; - const termsLoaded = (dictionary, entries, total, current) => { + const termsLoaded = (title, entries, total, current) => { const rows = []; for (const [expression, reading, tags, ...glossary] of entries) { rows.push({ - dictionary, expression, reading, tags, - glossary + glossary, + dictionary: title }); } @@ -180,16 +180,16 @@ class Dictionary { }); }; - const kanjiLoaded = (dictionary, entries, total, current) => { + const kanjiLoaded = (title, entries, total, current) => { const rows = []; for (const [character, onyomi, kunyomi, tags, ...meanings] of entries) { rows.push({ - dictionary, character, onyomi, kunyomi, tags, - meanings + meanings, + dictionary: title }); } diff --git a/ext/bg/js/options-form.js b/ext/bg/js/options-form.js index 9919031a..a37ebbaf 100644 --- a/ext/bg/js/options-form.js +++ b/ext/bg/js/options-form.js @@ -93,10 +93,10 @@ function getFormValues() { $('.dict').each((index, element) => { const dictionary = $(element); - const name = dictionary.data('name'); + const title = dictionary.data('title'); const enableTerms = dictionary.find('.dict-enable-terms').prop('checked'); const enableKanji = dictionary.find('.dict-enable-kanji').prop('checked'); - optsNew.dictionaries[name] = {enableTerms, enableKanji}; + optsNew.dictionaries[title] = {enableTerms, enableKanji}; }); return { @@ -168,9 +168,9 @@ function populateDictionaries(opts) { yomichan().translator.dictionary.getInfo().then(rows => { rows.forEach(row => { - const dictOpts = opts.dictionaries[row.dictionary] || {enableTerms: true, enableKanji: false}; + const dictOpts = opts.dictionaries[row.title] || {enableTerms: true, enableKanji: false}; const html = Handlebars.templates['dictionary.html']({ - name: row.dictionary, + title: row.title, version: row.version, hasTerms: row.hasTerms, hasKanji: row.hasKanji, diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 2caf6ba8..d42d972d 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -7,10 +7,10 @@ templates['dictionary.html'] = template({"1":function(container,depth0,helpers,p },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; - return "
    \n
    \n
    \n

    " - + alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper))) + + alias4(((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) + " v." + alias4(((helper = (helper = helpers.version || (depth0 != null ? depth0.version : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"version","hash":{},"data":data}) : helper))) + "

    \n
    \n
    \n \n
    \n
    \n\n
    +
    -

    {{name}} v.{{version}}

    +

    {{title}} v.{{version}}