summaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-03-15 21:13:58 -0700
committerAlex Yatskov <alex@foosoft.net>2017-03-15 21:13:58 -0700
commit8893db14caa6d34117dcb7e38ec1af32baa89b95 (patch)
tree9ef3655bed5e13751b4ea5488c92d132d250ead7 /ext/mixed/js
parent8fb398aad8752f3307452f1a1d3459bace77a97c (diff)
wip
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js23
1 files changed, 21 insertions, 2 deletions
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));
}