From 9d31801b73ad3f2a273f20aecda0e7157c481d46 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 25 Mar 2017 18:08:42 -0700 Subject: more hotkey work --- ext/mixed/js/display.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'ext/mixed/js/display.js') 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 => { -- cgit v1.2.3