Cleanup
This commit is contained in:
parent
7fa51d682f
commit
3655e5a820
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Please read the steps outlined below to get quickly get up and running with Yomichan. For complete documentation,
|
Please read the steps outlined below to get quickly get up and running with Yomichan. For complete documentation,
|
||||||
visit the <a href="https://foosoft.net/projects/yomichan-chrome/">official homepage</a>.
|
visit the <a href="https://foosoft.net/projects/yomichan-chrome/" target="_blank">official homepage</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
@ -34,7 +34,7 @@ class Dictionary {
|
|||||||
terms: '++id, dictionary, expression, reading',
|
terms: '++id, dictionary, expression, reading',
|
||||||
kanji: '++, dictionary, character',
|
kanji: '++, dictionary, character',
|
||||||
entities: '++, dictionary',
|
entities: '++, dictionary',
|
||||||
dictionaries: '++, dictionary, version',
|
dictionaries: '++, title, version',
|
||||||
meta: 'name, value',
|
meta: 'name, value',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -144,16 +144,16 @@ class Dictionary {
|
|||||||
return Promise.reject('database not initialized');
|
return Promise.reject('database not initialized');
|
||||||
}
|
}
|
||||||
|
|
||||||
const indexLoaded = (dictionary, version, entities, hasTerms, hasKanji) => {
|
const indexLoaded = (title, version, entities, hasTerms, hasKanji) => {
|
||||||
return this.db.dictionaries.add({dictionary, version, hasTerms, hasKanji}).then(() => {
|
return this.db.dictionaries.add({title, version, hasTerms, hasKanji}).then(() => {
|
||||||
this.entities = entities || {};
|
this.entities = entities || {};
|
||||||
|
|
||||||
const rows = [];
|
const rows = [];
|
||||||
for (const name in entities || {}) {
|
for (const name in entities || {}) {
|
||||||
rows.push({
|
rows.push({
|
||||||
dictionary,
|
|
||||||
name,
|
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 = [];
|
const rows = [];
|
||||||
for (const [expression, reading, tags, ...glossary] of entries) {
|
for (const [expression, reading, tags, ...glossary] of entries) {
|
||||||
rows.push({
|
rows.push({
|
||||||
dictionary,
|
|
||||||
expression,
|
expression,
|
||||||
reading,
|
reading,
|
||||||
tags,
|
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 = [];
|
const rows = [];
|
||||||
for (const [character, onyomi, kunyomi, tags, ...meanings] of entries) {
|
for (const [character, onyomi, kunyomi, tags, ...meanings] of entries) {
|
||||||
rows.push({
|
rows.push({
|
||||||
dictionary,
|
|
||||||
character,
|
character,
|
||||||
onyomi,
|
onyomi,
|
||||||
kunyomi,
|
kunyomi,
|
||||||
tags,
|
tags,
|
||||||
meanings
|
meanings,
|
||||||
|
dictionary: title
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,10 +93,10 @@ function getFormValues() {
|
|||||||
|
|
||||||
$('.dict').each((index, element) => {
|
$('.dict').each((index, element) => {
|
||||||
const dictionary = $(element);
|
const dictionary = $(element);
|
||||||
const name = dictionary.data('name');
|
const title = dictionary.data('title');
|
||||||
const enableTerms = dictionary.find('.dict-enable-terms').prop('checked');
|
const enableTerms = dictionary.find('.dict-enable-terms').prop('checked');
|
||||||
const enableKanji = dictionary.find('.dict-enable-kanji').prop('checked');
|
const enableKanji = dictionary.find('.dict-enable-kanji').prop('checked');
|
||||||
optsNew.dictionaries[name] = {enableTerms, enableKanji};
|
optsNew.dictionaries[title] = {enableTerms, enableKanji};
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -168,9 +168,9 @@ function populateDictionaries(opts) {
|
|||||||
|
|
||||||
yomichan().translator.dictionary.getInfo().then(rows => {
|
yomichan().translator.dictionary.getInfo().then(rows => {
|
||||||
rows.forEach(row => {
|
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']({
|
const html = Handlebars.templates['dictionary.html']({
|
||||||
name: row.dictionary,
|
title: row.title,
|
||||||
version: row.version,
|
version: row.version,
|
||||||
hasTerms: row.hasTerms,
|
hasTerms: row.hasTerms,
|
||||||
hasKanji: row.hasKanji,
|
hasKanji: row.hasKanji,
|
||||||
|
@ -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) {
|
},"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;
|
var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
|
||||||
|
|
||||||
return "<div class=\"dict well well-sm\" data-name=\""
|
return "<div class=\"dict well well-sm\" data-title=\""
|
||||||
+ 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)))
|
||||||
+ "\">\n <div class=\"row\">\n <div class=\"col-xs-8\">\n <h4><span class=\"text-muted glyphicon glyphicon-book\"></span> "
|
+ "\">\n <div class=\"row\">\n <div class=\"col-xs-8\">\n <h4><span class=\"text-muted glyphicon glyphicon-book\"></span> "
|
||||||
+ 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)))
|
||||||
+ " <small>v."
|
+ " <small>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)))
|
+ 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)))
|
||||||
+ "</small></h4>\n </div>\n <div class=\"col-xs-4 text-right\">\n <button type=\"button\" class=\"dict-delete btn btn-danger\">Delete</button>\n </div>\n </div>\n\n <div class=\"checkbox "
|
+ "</small></h4>\n </div>\n <div class=\"col-xs-4 text-right\">\n <button type=\"button\" class=\"dict-delete btn btn-danger\">Delete</button>\n </div>\n </div>\n\n <div class=\"checkbox "
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="dict well well-sm" data-name="{{name}}">
|
<div class="dict well well-sm" data-title="{{title}}">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-8">
|
<div class="col-xs-8">
|
||||||
<h4><span class="text-muted glyphicon glyphicon-book"></span> {{name}} <small>v.{{version}}</small></h4>
|
<h4><span class="text-muted glyphicon glyphicon-book"></span> {{title}} <small>v.{{version}}</small></h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-4 text-right">
|
<div class="col-xs-4 text-right">
|
||||||
<button type="button" class="dict-delete btn btn-danger">Delete</button>
|
<button type="button" class="dict-delete btn btn-danger">Delete</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user