From 8893db14caa6d34117dcb7e38ec1af32baa89b95 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Wed, 15 Mar 2017 21:13:58 -0700 Subject: wip --- ext/mixed/js/display.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'ext/mixed/js') diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 1de65f22..cab2cfea 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -66,14 +66,20 @@ class Display { this.spinner.hide(); this.templateRender('terms.html', params).then(content => { + window.scrollTo(0, 0); this.container.html(content); + $('.action-add-note').click(this.onActionAddNote.bind(this)); $('.action-play-audio').click(this.onActionPlayAudio.bind(this)); $('.kanji-link').click(e => { e.preventDefault(); const character = $(e.target).text(); - this.kanjiFind(character).then(definitions => { - this.showKanjiDefs(definitions, options, context); + this.kanjiFind(character).then(kanjiDefs => { + this.showKanjiDefs( + kanjiDefs, + options, + {definitions, sentence: context.sentence, url: context.url} + ); }).catch(this.handleError.bind(this)); }); @@ -99,8 +105,21 @@ class Display { this.spinner.hide(); this.templateRender('kanji.html', params).then(content => { + window.scrollTo(0, 0); this.container.html(content); + $('.action-add-note').click(this.onActionAddNote.bind(this)); + $('.term-source').click(e => { + e.preventDefault(); + if (context.definitions) { + this.showTermDefs( + context.definitions, + options, + {sentence: context.sentence, url: context.url} + ); + } + }); + return this.adderButtonsUpdate(['kanji'], sequence); }).catch(this.handleError.bind(this)); } -- cgit v1.2.3