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 /ext/mixed/js/display.js | |
parent | 2580dd8e7fc21bc5c39521f777a53c2aa790cfe1 (diff) |
more hotkey work
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r-- | ext/mixed/js/display.js | 29 |
1 files changed, 18 insertions, 11 deletions
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 => { |