This commit is contained in:
Alex Yatskov 2017-03-18 09:48:53 -07:00
parent a55b74c92e
commit f39323126d
5 changed files with 123 additions and 136 deletions

View File

@ -299,17 +299,13 @@ 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(11, data, 0),"inverse":container.program(15, 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(11, data, 0),"inverse":container.program(15, data, 0),"data":data})) != null ? stack1 : "")
+ " </div>\n</div>\n"; + " </div>\n</div>\n";
},"2":function(container,depth0,helpers,partials,data) { },"2":function(container,depth0,helpers,partials,data) {
var helper; return " <a href=\"#\" title=\"Add Kanji\" class=\"action-add-note pending disabled\" data-mode=\"kanji\"><img src=\"/mixed/img/add-kanji.png\" alt></a>\n";
return " <a href=\"#\" title=\"Add Kanji\" class=\"action-add-note pending disabled\" data-mode=\"kanji\" data-index=\""
+ container.escapeExpression(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"index","hash":{},"data":data}) : helper)))
+ "\"><img src=\"/mixed/img/add-kanji.png\"></a>\n";
},"4":function(container,depth0,helpers,partials,data) { },"4":function(container,depth0,helpers,partials,data) {
return " <a href=\"#\" title=\"Source term\" class=\"source-term\"><img src=\"/mixed/img/source-term.png\"></a>\n"; return " <a href=\"#\" title=\"Source term\" class=\"source-term\"><img src=\"/mixed/img/source-term.png\" alt></a>\n";
},"6":function(container,depth0,helpers,partials,data) { },"6":function(container,depth0,helpers,partials,data) {
var stack1; var stack1;
return " " return " "
+ container.escapeExpression(container.lambda(depth0, depth0)) + container.escapeExpression(container.lambda(depth0, depth0))
+ ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(data && data.last),{"name":"unless","hash":{},"fn":container.program(7, 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(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n"; + "\n";
@ -318,7 +314,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
},"9":function(container,depth0,helpers,partials,data) { },"9":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;
return " <span class=\"label label-default tag-" return " <span class=\"label label-default tag-"
+ alias4(((helper = (helper = helpers.category || (depth0 != null ? depth0.category : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"category","hash":{},"data":data}) : helper))) + alias4(((helper = (helper = helpers.category || (depth0 != null ? depth0.category : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"category","hash":{},"data":data}) : helper)))
+ "\" title=\"" + "\" title=\""
+ alias4(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"notes","hash":{},"data":data}) : helper))) + alias4(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"notes","hash":{},"data":data}) : helper)))
@ -328,12 +324,12 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
},"11":function(container,depth0,helpers,partials,data) { },"11":function(container,depth0,helpers,partials,data) {
var stack1; var stack1;
return " <ol>\n" return " <ol>\n"
+ ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(12, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </ol>\n"; + " </ol>\n";
},"12":function(container,depth0,helpers,partials,data) { },"12":function(container,depth0,helpers,partials,data) {
var stack1, helper, options, buffer = var stack1, helper, options, buffer =
" <li><span class=\"glossary-item\">"; " <li><span class=\"glossary-item\">";
stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},options) : helper)); stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},options) : helper));
if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)} if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
if (stack1 != null) { buffer += stack1; } if (stack1 != null) { buffer += stack1; }
@ -342,7 +338,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
return container.escapeExpression(container.lambda(depth0, depth0)); return container.escapeExpression(container.lambda(depth0, depth0));
},"15":function(container,depth0,helpers,partials,data) { },"15":function(container,depth0,helpers,partials,data) {
var stack1, helper, options, buffer = var stack1, helper, options, buffer =
" <div class=\"glossary-item\">"; " <div class=\"glossary-item\">";
stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},options) : helper)); stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(16, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},options) : helper));
if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)} if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
if (stack1 != null) { buffer += stack1; } if (stack1 != null) { buffer += stack1; }
@ -358,14 +354,13 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
},"19":function(container,depth0,helpers,partials,data,blockParams,depths) { },"19":function(container,depth0,helpers,partials,data,blockParams,depths) {
var stack1; var stack1;
return " " return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(data && data.first),{"name":"unless","hash":{},"fn":container.program(20, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(data && data.first),{"name":"unless","hash":{},"fn":container.program(20, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n" + "\n"
+ ((stack1 = container.invokePartial(partials.kanji,depth0,{"name":"kanji","hash":{"root":(depths[1] != null ? depths[1].root : depths[1]),"source":(depths[1] != null ? depths[1].source : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1])},"data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); + ((stack1 = container.invokePartial(partials.kanji,depth0,{"name":"kanji","hash":{"root":(depths[1] != null ? depths[1].root : depths[1]),"source":(depths[1] != null ? depths[1].source : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
},"20":function(container,depth0,helpers,partials,data) { },"20":function(container,depth0,helpers,partials,data) {
return "<hr>"; return "<hr>";
},"22":function(container,depth0,helpers,partials,data) { },"22":function(container,depth0,helpers,partials,data) {
return " <p>No results found.</p>\n"; return "<p>No results found.</p>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
var stack1; var stack1;
@ -381,7 +376,7 @@ templates['kanji.html'] = template({"1":function(container,depth0,helpers,partia
,"useDecorators":true,"usePartial":true,"useData":true,"useDepths":true}); ,"useDecorators":true,"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))
+ "</a></li>\n"; + "</a></li>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
@ -405,13 +400,13 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia
},"2":function(container,depth0,helpers,partials,data) { },"2":function(container,depth0,helpers,partials,data) {
var stack1; var stack1;
return " <div>\n" return "<div>\n"
+ ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.tags : depth0),{"name":"each","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </div>\n"; + "</div>\n";
},"3":function(container,depth0,helpers,partials,data) { },"3":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;
return " <span class=\"label label-default tag-" return " <span class=\"label label-default tag-"
+ alias4(((helper = (helper = helpers.category || (depth0 != null ? depth0.category : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"category","hash":{},"data":data}) : helper))) + alias4(((helper = (helper = helpers.category || (depth0 != null ? depth0.category : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"category","hash":{},"data":data}) : helper)))
+ "\" title=\"" + "\" title=\""
+ alias4(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"notes","hash":{},"data":data}) : helper))) + alias4(((helper = (helper = helpers.notes || (depth0 != null ? depth0.notes : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"notes","hash":{},"data":data}) : helper)))
@ -421,12 +416,12 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia
},"5":function(container,depth0,helpers,partials,data) { },"5":function(container,depth0,helpers,partials,data) {
var stack1; var stack1;
return " <ul>\n" return "<ul>\n"
+ ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.glossary : depth0),{"name":"each","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </ul>\n"; + "</ul>\n";
},"6":function(container,depth0,helpers,partials,data) { },"6":function(container,depth0,helpers,partials,data) {
var stack1, helper, options, buffer = var stack1, helper, options, buffer =
" <li><span class=\"glossary-item\">"; " <li><span class=\"glossary-item\">";
stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},options) : helper)); stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},options) : helper));
if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)} if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
if (stack1 != null) { buffer += stack1; } if (stack1 != null) { buffer += stack1; }
@ -435,7 +430,7 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia
return container.escapeExpression(container.lambda(depth0, depth0)); return container.escapeExpression(container.lambda(depth0, depth0));
},"9":function(container,depth0,helpers,partials,data) { },"9":function(container,depth0,helpers,partials,data) {
var stack1, helper, options, buffer = var stack1, helper, options, buffer =
" <div class=\"glossary-item\">"; "<div class=\"glossary-item\">";
stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},options) : helper)); stack1 = ((helper = (helper = helpers.multiLine || (depth0 != null ? depth0.multiLine : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"multiLine","hash":{},"fn":container.program(10, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},options) : helper));
if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)} if (!helpers.multiLine) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
if (stack1 != null) { buffer += stack1; } if (stack1 != null) { buffer += stack1; }
@ -458,22 +453,12 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.grouped : depth0),{"name":"if","hash":{},"fn":container.program(26, data, 0),"inverse":container.program(32, data, 0),"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.grouped : depth0),{"name":"if","hash":{},"fn":container.program(26, data, 0),"inverse":container.program(32, data, 0),"data":data})) != null ? stack1 : "")
+ " </div>\n</div>\n"; + " </div>\n</div>\n";
},"13":function(container,depth0,helpers,partials,data) { },"13":function(container,depth0,helpers,partials,data) {
var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; return " <a href=\"#\" title=\"Add expression\" class=\"action-add-note pending disabled\" data-mode=\"term-kanji\"><img src=\"/mixed/img/add-term-kanji.png\" alt></a>\n <a href=\"#\" title=\"Add reading\" class=\"action-add-note pending disabled\" data-mode=\"term-kana\"><img src=\"/mixed/img/add-term-kana.png\" alt></a>\n";
return " <a href=\"#\" title=\"Add term as expression\" class=\"action-add-note pending disabled\" data-mode=\"term-kanji\" data-index=\""
+ alias4(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"index","hash":{},"data":data}) : helper)))
+ "\"><img src=\"/mixed/img/add-term-kanji.png\"></a>\n <a href=\"#\" title=\"Add term as reading\" class=\"action-add-note pending disabled\" data-mode=\"term-kana\" data-index=\""
+ alias4(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"index","hash":{},"data":data}) : helper)))
+ "\"><img src=\"/mixed/img/add-term-kana.png\"></a>\n";
},"15":function(container,depth0,helpers,partials,data) { },"15":function(container,depth0,helpers,partials,data) {
var helper; return " <a href=\"#\" title=\"Play audio\" class=\"action-play-audio\"><img src=\"/mixed/img/play-audio.png\" alt></a>\n";
return " <a href=\"#\" title=\"Play audio\" class=\"action-play-audio\" data-index=\""
+ container.escapeExpression(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"index","hash":{},"data":data}) : helper)))
+ "\"><img src=\"/mixed/img/play-audio.png\"></a>\n";
},"17":function(container,depth0,helpers,partials,data) { },"17":function(container,depth0,helpers,partials,data) {
var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", buffer = var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", buffer =
" <div class=\"expression\"><ruby>"; " <div class=\"expression\"><ruby>";
stack1 = ((helper = (helper = helpers.kanjiLinks || (depth0 != null ? depth0.kanjiLinks : depth0)) != null ? helper : alias2),(options={"name":"kanjiLinks","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data}),(typeof helper === alias3 ? helper.call(alias1,options) : helper)); stack1 = ((helper = (helper = helpers.kanjiLinks || (depth0 != null ? depth0.kanjiLinks : depth0)) != null ? helper : alias2),(options={"name":"kanjiLinks","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data}),(typeof helper === alias3 ? helper.call(alias1,options) : helper));
if (!helpers.kanjiLinks) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)} if (!helpers.kanjiLinks) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
if (stack1 != null) { buffer += stack1; } if (stack1 != null) { buffer += stack1; }
@ -486,7 +471,7 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia
return container.escapeExpression(((helper = (helper = helpers.expression || (depth0 != null ? depth0.expression : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"expression","hash":{},"data":data}) : helper))); return container.escapeExpression(((helper = (helper = helpers.expression || (depth0 != null ? depth0.expression : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"expression","hash":{},"data":data}) : helper)));
},"20":function(container,depth0,helpers,partials,data) { },"20":function(container,depth0,helpers,partials,data) {
var stack1, helper, options, buffer = var stack1, helper, options, buffer =
" <div class=\"expression\">"; " <div class=\"expression\">";
stack1 = ((helper = (helper = helpers.kanjiLinks || (depth0 != null ? depth0.kanjiLinks : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"kanjiLinks","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},options) : helper)); stack1 = ((helper = (helper = helpers.kanjiLinks || (depth0 != null ? depth0.kanjiLinks : depth0)) != null ? helper : helpers.helperMissing),(options={"name":"kanjiLinks","hash":{},"fn":container.program(18, data, 0),"inverse":container.noop,"data":data}),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},options) : helper));
if (!helpers.kanjiLinks) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)} if (!helpers.kanjiLinks) { stack1 = helpers.blockHelperMissing.call(depth0,stack1,options)}
if (stack1 != null) { buffer += stack1; } if (stack1 != null) { buffer += stack1; }
@ -494,13 +479,13 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia
},"22":function(container,depth0,helpers,partials,data) { },"22":function(container,depth0,helpers,partials,data) {
var stack1; var stack1;
return " <div class=\"reasons\">\n" return " <div class=\"reasons\">\n"
+ ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.reasons : depth0),{"name":"each","hash":{},"fn":container.program(23, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.reasons : depth0),{"name":"each","hash":{},"fn":container.program(23, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ " </div>\n"; + " </div>\n";
},"23":function(container,depth0,helpers,partials,data) { },"23":function(container,depth0,helpers,partials,data) {
var stack1; var stack1;
return " <span class=\"reasons\">" 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(24, 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(24, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
@ -520,13 +505,13 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia
},"28":function(container,depth0,helpers,partials,data) { },"28":function(container,depth0,helpers,partials,data) {
var stack1; var stack1;
return " <li>" return " <li>"
+ ((stack1 = container.invokePartial(partials.definition,depth0,{"name":"definition","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "") + ((stack1 = container.invokePartial(partials.definition,depth0,{"name":"definition","data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "")
+ "</li>\n"; + "</li>\n";
},"30":function(container,depth0,helpers,partials,data) { },"30":function(container,depth0,helpers,partials,data) {
var stack1; var stack1;
return ((stack1 = container.invokePartial(partials.definition,((stack1 = (depth0 != null ? depth0.definitions : depth0)) != null ? stack1["0"] : stack1),{"name":"definition","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); return ((stack1 = container.invokePartial(partials.definition,((stack1 = (depth0 != null ? depth0.definitions : depth0)) != null ? stack1["0"] : stack1),{"name":"definition","data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
},"32":function(container,depth0,helpers,partials,data) { },"32":function(container,depth0,helpers,partials,data) {
var stack1; var stack1;
@ -538,14 +523,13 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia
},"35":function(container,depth0,helpers,partials,data,blockParams,depths) { },"35":function(container,depth0,helpers,partials,data,blockParams,depths) {
var stack1; var stack1;
return " " return ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(data && data.first),{"name":"unless","hash":{},"fn":container.program(36, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers.unless.call(depth0 != null ? depth0 : {},(data && data.first),{"name":"unless","hash":{},"fn":container.program(36, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n" + "\n"
+ ((stack1 = container.invokePartial(partials.term,depth0,{"name":"term","hash":{"playback":(depths[1] != null ? depths[1].playback : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1]),"grouped":(depths[1] != null ? depths[1].grouped : depths[1])},"data":data,"indent":" ","helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : ""); + ((stack1 = container.invokePartial(partials.term,depth0,{"name":"term","hash":{"playback":(depths[1] != null ? depths[1].playback : depths[1]),"addable":(depths[1] != null ? depths[1].addable : depths[1]),"grouped":(depths[1] != null ? depths[1].grouped : depths[1])},"data":data,"helpers":helpers,"partials":partials,"decorators":container.decorators})) != null ? stack1 : "");
},"36":function(container,depth0,helpers,partials,data) { },"36":function(container,depth0,helpers,partials,data) {
return "<hr>"; return "<hr>";
},"38":function(container,depth0,helpers,partials,data) { },"38":function(container,depth0,helpers,partials,data) {
return " <p>No results found.</p>\n"; return "<p>No results found.</p>\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) { },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
var stack1; var stack1;

View File

@ -47,6 +47,9 @@ class Display {
} }
showTermDefs(definitions, options, context) { showTermDefs(definitions, options, context) {
this.spinner.hide();
this.definitions = definitions;
const sequence = ++this.sequence; const sequence = ++this.sequence;
const params = { const params = {
definitions, definitions,
@ -56,26 +59,29 @@ class Display {
}; };
if (context) { if (context) {
definitions.forEach(definition => { for (const definition of definitions) {
definition.sentence = context.sentence; definition.sentence = context.sentence;
definition.url = context.url; definition.url = context.url;
}); }
} }
this.definitions = definitions;
this.spinner.hide();
this.templateRender('terms.html', params).then(content => { this.templateRender('terms.html', params).then(content => {
this.container.html(content); this.container.html(content);
let offset = 0;
if (context && context.hasOwnProperty('index') && context.index < definitions.length) { if (context && context.hasOwnProperty('index') && context.index < definitions.length) {
const entry = $('.entry').eq(context.index); const entry = $('.entry').eq(context.index);
window.scrollTo(0, entry.offset().top); offset = entry.offset().top;
} else {
window.scrollTo(0, 0);
} }
window.scrollTo(0, offset);
$('.action-add-note').click(this.onActionAddNote.bind(this)); $('.action-add-note').click(this.onActionAddNote.bind(this));
$('.action-play-audio').click(this.onActionPlayAudio.bind(this)); $('.action-play-audio').click(e => {
e.preventDefault();
const index = Display.entryIndexFind($(e.currentTarget));
Display.audioPlay(this.definitions[index], this.audioCache);
});
$('.kanji-link').click(e => { $('.kanji-link').click(e => {
e.preventDefault(); e.preventDefault();
@ -83,7 +89,7 @@ class Display {
if (context) { if (context) {
context.source = { context.source = {
definitions, definitions,
index: $('.entry').index(link.closest('.entry')) index: Display.entryIndexFind(link)
}; };
} }
@ -97,6 +103,9 @@ class Display {
} }
showKanjiDefs(definitions, options, context) { showKanjiDefs(definitions, options, context) {
this.spinner.hide();
this.definitions = definitions;
const sequence = ++this.sequence; const sequence = ++this.sequence;
const params = { const params = {
definitions, definitions,
@ -105,18 +114,15 @@ class Display {
}; };
if (context) { if (context) {
definitions.forEach(definition => { for (const definition of definitions) {
definition.sentence = context.sentence; definition.sentence = context.sentence;
definition.url = context.url; definition.url = context.url;
}); }
} }
this.definitions = definitions;
this.spinner.hide();
this.templateRender('kanji.html', params).then(content => { this.templateRender('kanji.html', params).then(content => {
window.scrollTo(0, 0);
this.container.html(content); this.container.html(content);
window.scrollTo(0, 0);
$('.action-add-note').click(this.onActionAddNote.bind(this)); $('.action-add-note').click(this.onActionAddNote.bind(this));
$('.source-term').click(e => { $('.source-term').click(e => {
@ -132,10 +138,6 @@ class Display {
}).catch(this.handleError.bind(this)); }).catch(this.handleError.bind(this));
} }
adderButtonFind(index, mode) {
return $(`.action-add-note[data-index="${index}"][data-mode="${mode}"]`);
}
adderButtonsUpdate(modes, sequence) { adderButtonsUpdate(modes, sequence) {
return this.definitionsAddable(this.definitions, modes).then(states => { return this.definitionsAddable(this.definitions, modes).then(states => {
if (states === null || sequence !== this.sequence) { if (states === null || sequence !== this.sequence) {
@ -144,7 +146,7 @@ class Display {
states.forEach((state, index) => { states.forEach((state, index) => {
for (const mode in state) { for (const mode in state) {
const button = this.adderButtonFind(index, mode); const button = Display.adderButtonFind(index, mode);
if (state[mode]) { if (state[mode]) {
button.removeClass('disabled'); button.removeClass('disabled');
} else { } else {
@ -157,21 +159,15 @@ class Display {
}); });
} }
onActionPlayAudio(e) {
e.preventDefault();
const index = $(e.currentTarget).data('index');
this.audioPlay(this.definitions[index]);
}
onActionAddNote(e) { onActionAddNote(e) {
e.preventDefault(); e.preventDefault();
this.spinner.show(); this.spinner.show();
const link = $(e.currentTarget); const link = $(e.currentTarget);
const index = link.data('index');
const mode = link.data('mode'); const mode = link.data('mode');
const index = Display.entryIndexFind(link);
const definition = this.definitions[index]; const definition = this.definitions[index];
if (mode !== 'kanji') { if (mode !== 'kanji') {
const url = Display.audioBuildUrl(definition); const url = Display.audioBuildUrl(definition);
const filename = Display.audioBuildFilename(definition); const filename = Display.audioBuildFilename(definition);
@ -182,17 +178,16 @@ class Display {
this.definitionAdd(definition, mode).then(success => { this.definitionAdd(definition, mode).then(success => {
if (success) { if (success) {
const button = this.adderButtonFind(index, mode); Display.adderButtonFind(index, mode).addClass('disabled');
button.addClass('disabled');
} else { } else {
this.handleError('note could not be added'); this.handleError('note could not be added');
} }
}).catch(this.handleError.bind(this)).then(() => this.spinner.hide()); }).catch(this.handleError.bind(this)).then(() => this.spinner.hide());
} }
audioPlay(definition) { static audioPlay(definition, cache) {
for (const key in this.audioCache) { for (const key in cache) {
const audio = this.audioCache[key]; const audio = cache[key];
if (audio !== null) { if (audio !== null) {
audio.pause(); audio.pause();
} }
@ -203,7 +198,7 @@ class Display {
return; return;
} }
let audio = this.audioCache[url]; let audio = cache[url];
if (audio) { if (audio) {
audio.currentTime = 0; audio.currentTime = 0;
audio.play(); audio.play();
@ -214,12 +209,20 @@ class Display {
audio = new Audio('/mixed/mp3/button.mp3'); audio = new Audio('/mixed/mp3/button.mp3');
} }
this.audioCache[url] = audio; cache[url] = audio;
audio.play(); audio.play();
}; };
} }
} }
static entryIndexFind(element) {
return $('.entry').index(element.closest('.entry'));
}
static adderButtonFind(index, mode) {
return $('.entry').eq(index).find(`.action-add-note[data-mode="${mode}"]`);
}
static audioBuildUrl(definition) { static audioBuildUrl(definition) {
let kana = definition.reading; let kana = definition.reading;
let kanji = definition.expression; let kanji = definition.expression;

View File

@ -2,10 +2,10 @@
<div class="entry"> <div class="entry">
<div class="actions"> <div class="actions">
{{#if addable}} {{#if addable}}
<a href="#" title="Add Kanji" class="action-add-note pending disabled" data-mode="kanji" data-index="{{@index}}"><img src="/mixed/img/add-kanji.png"></a> <a href="#" title="Add Kanji" class="action-add-note pending disabled" data-mode="kanji"><img src="/mixed/img/add-kanji.png" alt></a>
{{/if}} {{/if}}
{{#if source}} {{#if source}}
<a href="#" title="Source term" class="source-term"><img src="/mixed/img/source-term.png"></a> <a href="#" title="Source term" class="source-term"><img src="/mixed/img/source-term.png" alt></a>
{{/if}} {{/if}}
</div> </div>
@ -17,7 +17,7 @@
<th>Kunyomi:</th> <th>Kunyomi:</th>
<td> <td>
{{#each kunyomi}} {{#each kunyomi}}
{{.}}{{#unless @last}}, {{/unless}} {{.}}{{#unless @last}}, {{/unless}}
{{/each}} {{/each}}
</td> </td>
</tr> </tr>
@ -25,7 +25,7 @@
<th>Onyomi:</th> <th>Onyomi:</th>
<td> <td>
{{#each onyomi}} {{#each onyomi}}
{{.}}{{#unless @last}}, {{/unless}} {{.}}{{#unless @last}}, {{/unless}}
{{/each}} {{/each}}
</td> </td>
</tr> </tr>
@ -34,29 +34,29 @@
<div> <div>
{{#each tags}} {{#each tags}}
<span class="label label-default tag-{{category}}" title="{{notes}}">{{name}}</span> <span class="label label-default tag-{{category}}" title="{{notes}}">{{name}}</span>
{{/each}} {{/each}}
</div> </div>
<div class="glossary"> <div class="glossary">
{{#if glossary.[1]}} {{#if glossary.[1]}}
<ol> <ol>
{{#each glossary}} {{#each glossary}}
<li><span class="glossary-item">{{#multiLine}}{{.}}{{/multiLine}}</span></li> <li><span class="glossary-item">{{#multiLine}}{{.}}{{/multiLine}}</span></li>
{{/each}} {{/each}}
</ol> </ol>
{{else}} {{else}}
<div class="glossary-item">{{#multiLine}}{{glossary.[0]}}{{/multiLine}}</div> <div class="glossary-item">{{#multiLine}}{{glossary.[0]}}{{/multiLine}}</div>
{{/if}} {{/if}}
</div> </div>
</div> </div>
{{/inline}} {{/inline}}
{{#if definitions}} {{#if definitions}}
{{#each definitions}} {{#each definitions}}
{{#unless @first}}<hr>{{/unless}} {{#unless @first}}<hr>{{/unless}}
{{> kanji addable=../addable source=../source root=../root}} {{> kanji addable=../addable source=../source root=../root}}
{{/each}} {{/each}}
{{else}} {{else}}
<p>No results found.</p> <p>No results found.</p>
{{/if}} {{/if}}

View File

@ -9,7 +9,7 @@
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
{{#each markers}} {{#each markers}}
<li><a class="marker-link" href="#">{{.}}</a></li> <li><a class="marker-link" href="#">{{.}}</a></li>
{{/each}} {{/each}}
</ul> </ul>
</div> </div>

View File

@ -1,71 +1,71 @@
{{#*inline "definition"}} {{#*inline "definition"}}
{{#if tags}} {{#if tags}}
<div> <div>
{{#each tags}} {{#each tags}}
<span class="label label-default tag-{{category}}" title="{{notes}}">{{name}}</span> <span class="label label-default tag-{{category}}" title="{{notes}}">{{name}}</span>
{{/each}} {{/each}}
</div> </div>
{{/if}} {{/if}}
{{#if glossary.[1]}} {{#if glossary.[1]}}
<ul> <ul>
{{#each glossary}} {{#each glossary}}
<li><span class="glossary-item">{{#multiLine}}{{.}}{{/multiLine}}</span></li> <li><span class="glossary-item">{{#multiLine}}{{.}}{{/multiLine}}</span></li>
{{/each}} {{/each}}
</ul> </ul>
{{else}} {{else}}
<div class="glossary-item">{{#multiLine}}{{glossary.[0]}}{{/multiLine}}</div> <div class="glossary-item">{{#multiLine}}{{glossary.[0]}}{{/multiLine}}</div>
{{/if}} {{/if}}
{{/inline}} {{/inline}}
{{#*inline "term"}} {{#*inline "term"}}
<div class="entry"> <div class="entry">
<div class="actions"> <div class="actions">
{{#if addable}} {{#if addable}}
<a href="#" title="Add term as expression" class="action-add-note pending disabled" data-mode="term-kanji" data-index="{{@index}}"><img src="/mixed/img/add-term-kanji.png"></a> <a href="#" title="Add expression" class="action-add-note pending disabled" data-mode="term-kanji"><img src="/mixed/img/add-term-kanji.png" alt></a>
<a href="#" title="Add term as reading" class="action-add-note pending disabled" data-mode="term-kana" data-index="{{@index}}"><img src="/mixed/img/add-term-kana.png"></a> <a href="#" title="Add reading" class="action-add-note pending disabled" data-mode="term-kana"><img src="/mixed/img/add-term-kana.png" alt></a>
{{/if}} {{/if}}
{{#if playback}} {{#if playback}}
<a href="#" title="Play audio" class="action-play-audio" data-index="{{@index}}"><img src="/mixed/img/play-audio.png"></a> <a href="#" title="Play audio" class="action-play-audio"><img src="/mixed/img/play-audio.png" alt></a>
{{/if}} {{/if}}
</div> </div>
{{#if reading}} {{#if reading}}
<div class="expression"><ruby>{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}<rt>{{reading}}</rt></ruby></div> <div class="expression"><ruby>{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}<rt>{{reading}}</rt></ruby></div>
{{else}} {{else}}
<div class="expression">{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}</div> <div class="expression">{{#kanjiLinks}}{{expression}}{{/kanjiLinks}}</div>
{{/if}} {{/if}}
{{#if reasons}} {{#if reasons}}
<div class="reasons"> <div class="reasons">
{{#each reasons}} {{#each reasons}}
<span class="reasons">{{.}}</span> {{#unless @last}}&laquo;{{/unless}} <span class="reasons">{{.}}</span> {{#unless @last}}&laquo;{{/unless}}
{{/each}} {{/each}}
</div> </div>
{{/if}} {{/if}}
<div class="glossary"> <div class="glossary">
{{#if grouped}} {{#if grouped}}
{{#if definitions.[1]}} {{#if definitions.[1]}}
<ol> <ol>
{{#each definitions}} {{#each definitions}}
<li>{{> definition}}</li> <li>{{> definition}}</li>
{{/each}} {{/each}}
</ol> </ol>
{{else}} {{else}}
{{> definition definitions.[0]}} {{> definition definitions.[0]}}
{{/if}} {{/if}}
{{else}} {{else}}
{{> definition}} {{> definition}}
{{/if}} {{/if}}
</div> </div>
</div> </div>
{{/inline}} {{/inline}}
{{#if definitions}} {{#if definitions}}
{{#each definitions}} {{#each definitions}}
{{#unless @first}}<hr>{{/unless}} {{#unless @first}}<hr>{{/unless}}
{{> term grouped=../grouped addable=../addable playback=../playback}} {{> term grouped=../grouped addable=../addable playback=../playback}}
{{/each}} {{/each}}
{{else}} {{else}}
<p>No results found.</p> <p>No results found.</p>
{{/if}} {{/if}}