diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-03-25 18:08:42 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-03-25 18:08:42 -0700 |
commit | 9d31801b73ad3f2a273f20aecda0e7157c481d46 (patch) | |
tree | 306d5cb13a8f86a2c5195beb95a29836864b7282 | |
parent | 2580dd8e7fc21bc5c39521f777a53c2aa790cfe1 (diff) |
more hotkey work
-rw-r--r-- | ext/bg/js/templates.js | 12 | ||||
-rw-r--r-- | ext/mixed/js/display.js | 29 | ||||
-rw-r--r-- | tmpl/kanji.html | 8 | ||||
-rw-r--r-- | tmpl/terms.html | 10 |
4 files changed, 33 insertions, 26 deletions
diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index f267da80..1afe124f 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -284,7 +284,7 @@ templates['fields.html'] = template({"1":function(container,depth0,helpers,parti templates['kanji.html'] = template({"1":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : {}; - return "<div class=\"entry\">\n <div class=\"actions\">\n <img src=\"/mixed/img/entry-current.png\" class=\"current\" title=\"Current entry (arrows / home / end)\" alt>\n" + return "<div class=\"entry\" data-type=\"kanji\">\n <div class=\"actions\">\n <img src=\"/mixed/img/entry-current.png\" class=\"current\" title=\"Current entry (Up/Down/Home/End/PgUp/PgDn)\" alt>\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.source : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " </div>\n\n <div class=\"glyph\">" @@ -299,9 +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 : "") + " </div>\n</div>\n"; },"2":function(container,depth0,helpers,partials,data) { - return " <a href=\"#\" class=\"action-add-note pending disabled\" data-mode=\"kanji\"><img src=\"/mixed/img/add-kanji.png\" title=\"Add Kanji ([)\" alt></a>\n"; + return " <a href=\"#\" class=\"action-add-note pending disabled\" data-mode=\"kanji\"><img src=\"/mixed/img/add-kanji.png\" title=\"Add Kanji (Alt + K)\" alt></a>\n"; },"4":function(container,depth0,helpers,partials,data) { - return " <a href=\"#\" class=\"source-term\"><img src=\"/mixed/img/source-term.png\" title=\"Source term (Backspace)\" alt></a>\n"; + return " <a href=\"#\" class=\"source-term\"><img src=\"/mixed/img/source-term.png\" title=\"Source term (Alt + B)\" alt></a>\n"; },"6":function(container,depth0,helpers,partials,data) { var stack1; @@ -442,7 +442,7 @@ templates['terms.html'] = template({"1":function(container,depth0,helpers,partia },"12":function(container,depth0,helpers,partials,data) { var stack1, alias1=depth0 != null ? depth0 : {}; - return "<div class=\"entry\">\n <div class=\"actions\">\n <img src=\"/mixed/img/entry-current.png\" class=\"current\" title=\"Current entry (arrows / home / end)\" alt>\n" + return "<div class=\"entry\" data-type=\"term\">\n <div class=\"actions\">\n <img src=\"/mixed/img/entry-current.png\" class=\"current\" title=\"Current entry (Up/Down/Home/End/PgUp/PgDn)\" alt>\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.addable : depth0),{"name":"if","hash":{},"fn":container.program(13, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.playback : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + " </div>\n\n" @@ -453,9 +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 : "") + " </div>\n</div>\n"; },"13":function(container,depth0,helpers,partials,data) { - return " <a href=\"#\" class=\"action-add-note pending disabled\" data-mode=\"term-kanji\"><img src=\"/mixed/img/add-term-kanji.png\" title=\"Add expression ([)\" alt></a>\n <a href=\"#\" class=\"action-add-note pending disabled\" data-mode=\"term-kana\"><img src=\"/mixed/img/add-term-kana.png\" title=\"Add reading (])\" alt></a>\n"; + return " <a href=\"#\" class=\"action-add-note pending disabled\" data-mode=\"term-kanji\"><img src=\"/mixed/img/add-term-kanji.png\" title=\"Add expression (Alt + E)\" alt></a>\n <a href=\"#\" class=\"action-add-note pending disabled\" data-mode=\"term-kana\"><img src=\"/mixed/img/add-term-kana.png\" title=\"Add reading (Alt + R)\" alt></a>\n"; },"15":function(container,depth0,helpers,partials,data) { - return " <a href=\"#\" class=\"action-play-audio\"><img src=\"/mixed/img/play-audio.png\" title=\"Play audio (\\)\" alt></a>\n"; + return " <a href=\"#\" class=\"action-play-audio\"><img src=\"/mixed/img/play-audio.png\" title=\"Play audio (Alt + P)\" alt></a>\n"; },"17":function(container,depth0,helpers,partials,data) { var stack1, helper, options, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", buffer = " <div class=\"expression\"><ruby>"; diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 639c2673..1b629dec 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -164,16 +164,7 @@ class Display { onSourceTerm(e) { e.preventDefault(); - - if (this.context && this.context.source) { - const context = { - url: this.context.source.url, - sentence: this.context.source.sentence, - index: this.context.source.index - }; - - this.showTermDefs(this.context.source.definitions, this.options, context); - } + this.sourceBack(); } onKanjiLookup(e) { @@ -247,6 +238,10 @@ class Display { this.entryScroll(this.index + 1, true); }, + 66: /* b */ () => { + this.sourceBack(); + }, + 69: /* e */ () => { noteTryAdd('term-kanji'); }, @@ -260,7 +255,7 @@ class Display { }, 80: /* p */ () => { - if (Display.adderButtonFind(this.index, 'kanji').length === 0) { + if ($('.entry').eq(this.index).data('type') === 'term') { this.audioPlay(this.definitions[this.index]); } } @@ -273,6 +268,18 @@ class Display { } } + sourceBack() { + if (this.context && this.context.source) { + const context = { + url: this.context.source.url, + sentence: this.context.source.sentence, + index: this.context.source.index + }; + + this.showTermDefs(this.context.source.definitions, this.options, context); + } + } + noteAdd(definition, mode) { this.spinner.show(); return this.definitionAdd(definition, mode).then(success => { diff --git a/tmpl/kanji.html b/tmpl/kanji.html index be5e8541..7a2df8db 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -1,12 +1,12 @@ {{#*inline "kanji"}} -<div class="entry"> +<div class="entry" data-type="kanji"> <div class="actions"> - <img src="/mixed/img/entry-current.png" class="current" title="Current entry (arrows / home / end)" alt> + <img src="/mixed/img/entry-current.png" class="current" title="Current entry (Up/Down/Home/End/PgUp/PgDn)" alt> {{#if addable}} - <a href="#" class="action-add-note pending disabled" data-mode="kanji"><img src="/mixed/img/add-kanji.png" title="Add Kanji ([)" alt></a> + <a href="#" class="action-add-note pending disabled" data-mode="kanji"><img src="/mixed/img/add-kanji.png" title="Add Kanji (Alt + K)" alt></a> {{/if}} {{#if source}} - <a href="#" class="source-term"><img src="/mixed/img/source-term.png" title="Source term (Backspace)" alt></a> + <a href="#" class="source-term"><img src="/mixed/img/source-term.png" title="Source term (Alt + B)" alt></a> {{/if}} </div> diff --git a/tmpl/terms.html b/tmpl/terms.html index f108da26..83b16106 100644 --- a/tmpl/terms.html +++ b/tmpl/terms.html @@ -18,15 +18,15 @@ {{/inline}} {{#*inline "term"}} -<div class="entry"> +<div class="entry" data-type="term"> <div class="actions"> - <img src="/mixed/img/entry-current.png" class="current" title="Current entry (arrows / home / end)" alt> + <img src="/mixed/img/entry-current.png" class="current" title="Current entry (Up/Down/Home/End/PgUp/PgDn)" alt> {{#if addable}} - <a href="#" class="action-add-note pending disabled" data-mode="term-kanji"><img src="/mixed/img/add-term-kanji.png" title="Add expression ([)" alt></a> - <a href="#" class="action-add-note pending disabled" data-mode="term-kana"><img src="/mixed/img/add-term-kana.png" title="Add reading (])" alt></a> + <a href="#" class="action-add-note pending disabled" data-mode="term-kanji"><img src="/mixed/img/add-term-kanji.png" title="Add expression (Alt + E)" alt></a> + <a href="#" class="action-add-note pending disabled" data-mode="term-kana"><img src="/mixed/img/add-term-kana.png" title="Add reading (Alt + R)" alt></a> {{/if}} {{#if playback}} - <a href="#" class="action-play-audio"><img src="/mixed/img/play-audio.png" title="Play audio (\)" alt></a> + <a href="#" class="action-play-audio"><img src="/mixed/img/play-audio.png" title="Play audio (Alt + P)" alt></a> {{/if}} </div> |