WIP
This commit is contained in:
parent
862b49dfd9
commit
238c9e340e
@ -30,10 +30,10 @@ class Database {
|
|||||||
|
|
||||||
this.db = new Dexie('dict');
|
this.db = new Dexie('dict');
|
||||||
this.db.version(1).stores({
|
this.db.version(1).stores({
|
||||||
terms: '++id, dictionary, expression, reading',
|
terms: '++id,dictionary,expression,reading',
|
||||||
kanji: '++, dictionary, character',
|
kanji: '++,dictionary,character',
|
||||||
tagMeta: '++, dictionary',
|
tagMeta: '++,dictionary',
|
||||||
dictionaries: '++, title, version',
|
dictionaries: '++,title,version',
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.db.open();
|
return this.db.open();
|
||||||
@ -48,7 +48,7 @@ class Database {
|
|||||||
return this.db.delete().then(() => {
|
return this.db.delete().then(() => {
|
||||||
this.db = null;
|
this.db = null;
|
||||||
this.tagMetaCache = {};
|
this.tagMetaCache = {};
|
||||||
this.prepare();
|
return this.prepare();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,6 +64,7 @@ class Database {
|
|||||||
expression: row.expression,
|
expression: row.expression,
|
||||||
reading: row.reading,
|
reading: row.reading,
|
||||||
tags: splitField(row.tags),
|
tags: splitField(row.tags),
|
||||||
|
rules: splitField(row.rules),
|
||||||
glossary: row.glossary,
|
glossary: row.glossary,
|
||||||
score: row.score,
|
score: row.score,
|
||||||
dictionary: row.dictionary,
|
dictionary: row.dictionary,
|
||||||
@ -123,11 +124,7 @@ class Database {
|
|||||||
const tagMeta = {};
|
const tagMeta = {};
|
||||||
promises.push(
|
promises.push(
|
||||||
this.db.tagMeta.where('dictionary').equals(dictionary).each(row => {
|
this.db.tagMeta.where('dictionary').equals(dictionary).each(row => {
|
||||||
tagMeta[row.name] = {
|
tagMeta[row.name] = {category: row.category, notes: row.notes, order: row.order};
|
||||||
category: row.category,
|
|
||||||
notes: row.notes,
|
|
||||||
order: row.order
|
|
||||||
};
|
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.tagMetaCache[dictionary] = tagMeta;
|
this.tagMetaCache[dictionary] = tagMeta;
|
||||||
})
|
})
|
||||||
|
@ -45,6 +45,30 @@ templates['header.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(c
|
|||||||
+ alias4(((helper = (helper = helpers.root || (depth0 != null ? depth0.root : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"root","hash":{},"data":data}) : helper)))
|
+ alias4(((helper = (helper = helpers.root || (depth0 != null ? depth0.root : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"root","hash":{},"data":data}) : helper)))
|
||||||
+ "/css/frame.css\">\n </head>\n <body>\n";
|
+ "/css/frame.css\">\n </head>\n <body>\n";
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
|
templates['kanji-link.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
|
||||||
|
var helper;
|
||||||
|
|
||||||
|
return "<a href=\"#\" class=\"kanji-link\">"
|
||||||
|
+ container.escapeExpression(((helper = (helper = helpers.kanji || (depth0 != null ? depth0.kanji : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"kanji","hash":{},"data":data}) : helper)))
|
||||||
|
+ "</a>\n";
|
||||||
|
},"useData":true});
|
||||||
|
templates['kanji-list.html'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
||||||
|
var stack1;
|
||||||
|
|
||||||
|
return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "");
|
||||||
|
},"2":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
||||||
|
var stack1;
|
||||||
|
|
||||||
|
return ((stack1 = container.invokePartial(partials["kanji.html"],depth0,{"name":"kanji.html","hash":{"sequence":(depths[1] != null ? depths[1].sequence : depths[1]),"options":(depths[1] != null ? depths[1].options : depths[1]),"root":(depths[1] != null ? depths[1].root : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1])},"data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
|
||||||
|
},"4":function(container,depth0,helpers,partials,data) {
|
||||||
|
return " <p>No results found</p>\n";
|
||||||
|
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
||||||
|
var stack1;
|
||||||
|
|
||||||
|
return ((stack1 = container.invokePartial(partials["header.html"],depth0,{"name":"header.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
|
||||||
|
+ ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.program(4, data, 0, blockParams, depths),"data":data})) != null ? stack1 : "")
|
||||||
|
+ ((stack1 = container.invokePartial(partials["footer.html"],depth0,{"name":"footer.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
|
||||||
|
},"usePartial":true,"useData":true,"useDepths":true});
|
||||||
templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data) {
|
templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data) {
|
||||||
var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
|
var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
|
||||||
|
|
||||||
@ -107,30 +131,6 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
|
|||||||
+ ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.program(11, data, 0),"data":data})) != null ? stack1 : "")
|
+ ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(8, data, 0),"inverse":container.program(11, data, 0),"data":data})) != null ? stack1 : "")
|
||||||
+ " </div>\n</div>\n";
|
+ " </div>\n</div>\n";
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
templates['kanji-link.html'] = template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
|
|
||||||
var helper;
|
|
||||||
|
|
||||||
return "<a href=\"#\" class=\"kanji-link\">"
|
|
||||||
+ container.escapeExpression(((helper = (helper = helpers.kanji || (depth0 != null ? depth0.kanji : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"kanji","hash":{},"data":data}) : helper)))
|
|
||||||
+ "</a>\n";
|
|
||||||
},"useData":true});
|
|
||||||
templates['kanji-list.html'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
|
||||||
var stack1;
|
|
||||||
|
|
||||||
return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "");
|
|
||||||
},"2":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
|
||||||
var stack1;
|
|
||||||
|
|
||||||
return ((stack1 = container.invokePartial(partials["kanji.html"],depth0,{"name":"kanji.html","hash":{"sequence":(depths[1] != null ? depths[1].sequence : depths[1]),"options":(depths[1] != null ? depths[1].options : depths[1]),"root":(depths[1] != null ? depths[1].root : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1])},"data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
|
|
||||||
},"4":function(container,depth0,helpers,partials,data) {
|
|
||||||
return " <p>No results found</p>\n";
|
|
||||||
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
|
||||||
var stack1;
|
|
||||||
|
|
||||||
return ((stack1 = container.invokePartial(partials["header.html"],depth0,{"name":"header.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
|
|
||||||
+ ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.program(4, data, 0, blockParams, depths),"data":data})) != null ? stack1 : "")
|
|
||||||
+ ((stack1 = container.invokePartial(partials["footer.html"],depth0,{"name":"footer.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
|
|
||||||
},"usePartial":true,"useData":true,"useDepths":true});
|
|
||||||
templates['model.html'] = template({"1":function(container,depth0,helpers,partials,data) {
|
templates['model.html'] = template({"1":function(container,depth0,helpers,partials,data) {
|
||||||
return " <li><a class=\"marker-link\" href=\"#\">"
|
return " <li><a class=\"marker-link\" href=\"#\">"
|
||||||
+ container.escapeExpression(container.lambda(depth0, depth0))
|
+ container.escapeExpression(container.lambda(depth0, depth0))
|
||||||
@ -148,6 +148,23 @@ templates['model.html'] = template({"1":function(container,depth0,helpers,partia
|
|||||||
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.markers : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.markers : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||||
+ " </ul>\n </div>\n </div>\n </td>\n</tr>\n";
|
+ " </ul>\n </div>\n </div>\n </td>\n</tr>\n";
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
|
templates['term-list.html'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
||||||
|
var stack1;
|
||||||
|
|
||||||
|
return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "");
|
||||||
|
},"2":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
||||||
|
var stack1;
|
||||||
|
|
||||||
|
return ((stack1 = container.invokePartial(partials["term.html"],depth0,{"name":"term.html","hash":{"sequence":(depths[1] != null ? depths[1].sequence : depths[1]),"options":(depths[1] != null ? depths[1].options : depths[1]),"root":(depths[1] != null ? depths[1].root : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1])},"data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
|
||||||
|
},"4":function(container,depth0,helpers,partials,data) {
|
||||||
|
return " <p>No results found</p>\n";
|
||||||
|
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
||||||
|
var stack1;
|
||||||
|
|
||||||
|
return ((stack1 = container.invokePartial(partials["header.html"],depth0,{"name":"header.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
|
||||||
|
+ ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.program(4, data, 0, blockParams, depths),"data":data})) != null ? stack1 : "")
|
||||||
|
+ ((stack1 = container.invokePartial(partials["footer.html"],depth0,{"name":"footer.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
|
||||||
|
},"usePartial":true,"useData":true,"useDepths":true});
|
||||||
templates['term.html'] = template({"1":function(container,depth0,helpers,partials,data) {
|
templates['term.html'] = template({"1":function(container,depth0,helpers,partials,data) {
|
||||||
var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
|
var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;
|
||||||
|
|
||||||
@ -191,7 +208,7 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial
|
|||||||
},"10":function(container,depth0,helpers,partials,data) {
|
},"10":function(container,depth0,helpers,partials,data) {
|
||||||
var stack1;
|
var stack1;
|
||||||
|
|
||||||
return " <span class=\"rule\">"
|
return " <span class=\"reasons\">"
|
||||||
+ container.escapeExpression(container.lambda(depth0, depth0))
|
+ container.escapeExpression(container.lambda(depth0, depth0))
|
||||||
+ "</span> "
|
+ "</span> "
|
||||||
+ ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(data && data.last),{"name":"unless","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
+ ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(data && data.last),{"name":"unless","hash":{},"fn":container.program(11, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||||
@ -234,29 +251,12 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial
|
|||||||
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||||
+ " </div>\n\n"
|
+ " </div>\n\n"
|
||||||
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.reading : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.program(8, data, 0),"data":data})) != null ? stack1 : "")
|
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.reading : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.program(8, data, 0),"data":data})) != null ? stack1 : "")
|
||||||
+ "\n <div class=\"term-rules\">\n"
|
+ "\n <div class=\"term-reasons\">\n"
|
||||||
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.rules : depth0),{"name":"each","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.reasons : depth0),{"name":"each","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||||
+ " </div>\n\n <div class=\"term-tags\">\n"
|
+ " </div>\n\n <div class=\"term-tags\">\n"
|
||||||
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
|
||||||
+ " </div>\n\n <div class=\"term-glossary\">\n"
|
+ " </div>\n\n <div class=\"term-glossary\">\n"
|
||||||
+ ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.program(18, data, 0),"data":data})) != null ? stack1 : "")
|
+ ((stack1 = helpers["if"].call(alias1,((stack1 = (depth0 != null ? depth0.glossary : depth0)) != null ? stack1["1"] : stack1),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.program(18, data, 0),"data":data})) != null ? stack1 : "")
|
||||||
+ " </div>\n</div>\n";
|
+ " </div>\n</div>\n";
|
||||||
},"useData":true});
|
},"useData":true});
|
||||||
templates['term-list.html'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
|
||||||
var stack1;
|
|
||||||
|
|
||||||
return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.definitions : depth0),{"name":"each","hash":{},"fn":container.program(2, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "");
|
|
||||||
},"2":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
|
||||||
var stack1;
|
|
||||||
|
|
||||||
return ((stack1 = container.invokePartial(partials["term.html"],depth0,{"name":"term.html","hash":{"sequence":(depths[1] != null ? depths[1].sequence : depths[1]),"options":(depths[1] != null ? depths[1].options : depths[1]),"root":(depths[1] != null ? depths[1].root : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1])},"data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
|
|
||||||
},"4":function(container,depth0,helpers,partials,data) {
|
|
||||||
return " <p>No results found</p>\n";
|
|
||||||
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
|
|
||||||
var stack1;
|
|
||||||
|
|
||||||
return ((stack1 = container.invokePartial(partials["header.html"],depth0,{"name":"header.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
|
|
||||||
+ ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.definitions : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.program(4, data, 0, blockParams, depths),"data":data})) != null ? stack1 : "")
|
|
||||||
+ ((stack1 = container.invokePartial(partials["footer.html"],depth0,{"name":"footer.html","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
|
|
||||||
},"usePartial":true,"useData":true,"useDepths":true});
|
|
||||||
})();
|
})();
|
@ -100,7 +100,7 @@ body {
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.term-rules {
|
.term-reasons {
|
||||||
color: #777;
|
color: #777;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
<div class="term-expression">{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}</div>
|
<div class="term-expression">{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<div class="term-rules">
|
<div class="term-reasons">
|
||||||
{{#each rules}}
|
{{#each reasons}}
|
||||||
<span class="rule">{{.}}</span> {{#unless @last}}«{{/unless}}
|
<span class="reasons">{{.}}</span> {{#unless @last}}«{{/unless}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user