diff options
-rw-r--r-- | ext/bg/js/templates.js | 22 | ||||
-rw-r--r-- | ext/fg/js/frame.js | 8 | ||||
-rw-r--r-- | tmpl/term.html | 8 |
3 files changed, 17 insertions, 21 deletions
diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 3408b334..b09c49dd 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -95,9 +95,9 @@ templates['kanji-list.html'] = template({"1":function(container,depth0,helpers,p templates['term.html'] = template({"1":function(container,depth0,helpers,partials,data,blockParams,depths) { var stack1, helper, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {}; - return " <div class=\"action-bar\">\n <a href=\"#\" title=\"Pronounce\" class=\"action-pronounce\" data-sequence=\"" + return " <div class=\"action-bar\" data-sequence=\"" + alias2(alias1((depths[1] != null ? depths[1].sequence : depths[1]), depth0)) - + "\" data-index=\"" + + "\">\n <a href=\"#\" title=\"Pronounce\" class=\"action-pronounce\" data-index=\"" + alias2(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias3,{"name":"index","hash":{},"data":data}) : helper))) + "\"><img src=\"" + alias2(alias1((depths[1] != null ? depths[1].root : depths[1]), depth0)) @@ -105,20 +105,16 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial + ((stack1 = helpers["if"].call(alias3,(depth0 != null ? depth0.enableAnkiConnect : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " </div>\n"; },"2":function(container,depth0,helpers,partials,data,blockParams,depths) { - var helper, alias1=container.lambda, alias2=container.escapeExpression, alias3=depth0 != null ? depth0 : {}, alias4=helpers.helperMissing, alias5="function"; + var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda; - return " <a href=\"#\" title=\"Add term as expression\" class=\"action-learn disabled\" data-sequence=\"" - + alias2(alias1((depths[1] != null ? depths[1].sequence : depths[1]), depth0)) - + "\" data-mode=\"vocab_kanji\" data-index=\"" - + alias2(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias4),(typeof helper === alias5 ? helper.call(alias3,{"name":"index","hash":{},"data":data}) : helper))) + return " <a href=\"#\" title=\"Add term as expression\" class=\"action-add-note disabled\" data-mode=\"vocab_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=\"" - + alias2(alias1((depths[1] != null ? depths[1].root : depths[1]), depth0)) - + "/img/add_vocab_kanji.png\"></a>\n <a href=\"#\" title=\"Add term as reading\" class=\"action-learn disabled\" data-sequence=\"" - + alias2(alias1((depths[1] != null ? depths[1].sequence : depths[1]), depth0)) - + "\" data-mode=\"vocab_kana\" data-index=\"" - + alias2(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : alias4),(typeof helper === alias5 ? helper.call(alias3,{"name":"index","hash":{},"data":data}) : helper))) + + alias4(alias5((depths[1] != null ? depths[1].root : depths[1]), depth0)) + + "/img/add_vocab_kanji.png\"></a>\n <a href=\"#\" title=\"Add term as reading\" class=\"action-add-note disabled\" data-mode=\"vocab_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=\"" - + alias2(alias1((depths[1] != null ? depths[1].root : depths[1]), depth0)) + + alias4(alias5((depths[1] != null ? depths[1].root : depths[1]), depth0)) + "/img/add_vocab_kana.png\"></a>\n"; },"4":function(container,depth0,helpers,partials,data) { var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", buffer = diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js index 376d4826..339958f2 100644 --- a/ext/fg/js/frame.js +++ b/ext/fg/js/frame.js @@ -26,8 +26,8 @@ function registerKanjiLinks() { } } -function registerLearnLinks() { - for (const link of [].slice.call(document.getElementsByClassName('action-learn'))) { +function registerAddNoteLinks() { + for (const link of [].slice.call(document.getElementsByClassName('action-add-note'))) { link.addEventListener('click', (e) => { e.preventDefault(); const ds = e.currentTarget.dataset; @@ -48,7 +48,7 @@ function registerPronounceLinks() { function onDomContentLoaded() { registerKanjiLinks(); - registerLearnLinks(); + registerAddNoteLinks(); registerPronounceLinks(); } @@ -61,7 +61,7 @@ function onMessage(e) { function api_setActionState({index, state, sequence}) { for (const mode in state) { - const matches = document.querySelectorAll(`.action-learn[data-sequence="${sequence}"][data-index="${index}"][data-mode="${mode}"]`); + const matches = document.querySelectorAll(`.action-bar[data-sequence="${sequence}"] .action-add-note[data-index="${index}"][data-mode="${mode}"]`); if (matches.length === 0) { return; } diff --git a/tmpl/term.html b/tmpl/term.html index b6861b03..ccc321e6 100644 --- a/tmpl/term.html +++ b/tmpl/term.html @@ -1,10 +1,10 @@ <div class="term-definition"> {{#with options}} - <div class="action-bar"> - <a href="#" title="Pronounce" class="action-pronounce" data-sequence="{{../sequence}}" data-index="{{@index}}"><img src="{{../root}}/img/pronounce.png"></a> + <div class="action-bar" data-sequence="{{../sequence}}"> + <a href="#" title="Pronounce" class="action-pronounce" data-index="{{@index}}"><img src="{{../root}}/img/pronounce.png"></a> {{#if enableAnkiConnect}} - <a href="#" title="Add term as expression" class="action-learn disabled" data-sequence="{{../sequence}}" data-mode="vocab_kanji" data-index="{{@index}}"><img src="{{../root}}/img/add_vocab_kanji.png"></a> - <a href="#" title="Add term as reading" class="action-learn disabled" data-sequence="{{../sequence}}" data-mode="vocab_kana" data-index="{{@index}}"><img src="{{../root}}/img/add_vocab_kana.png"></a> + <a href="#" title="Add term as expression" class="action-add-note disabled" data-mode="vocab_kanji" data-index="{{@index}}"><img src="{{../root}}/img/add_vocab_kanji.png"></a> + <a href="#" title="Add term as reading" class="action-add-note disabled" data-mode="vocab_kana" data-index="{{@index}}"><img src="{{../root}}/img/add_vocab_kana.png"></a> {{/if}} </div> {{/with}} |