cleanup
This commit is contained in:
parent
a55b74c92e
commit
f39323126d
@ -299,13 +299,9 @@ 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;
|
||||||
|
|
||||||
@ -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;
|
||||||
|
|
||||||
@ -405,9 +400,9 @@ 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;
|
||||||
|
|
||||||
@ -421,9 +416,9 @@ 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\">";
|
||||||
@ -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,19 +453,9 @@ 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>";
|
||||||
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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>
|
||||||
|
|
||||||
@ -53,10 +53,10 @@
|
|||||||
{{/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}}
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
{{#*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>
|
||||||
|
|
||||||
@ -62,10 +62,10 @@
|
|||||||
{{/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}}
|
||||||
|
Loading…
Reference in New Issue
Block a user