This commit is contained in:
Alex Yatskov 2017-03-04 19:27:54 -08:00
parent db7e80dabf
commit 158818713a

View File

@ -68,7 +68,14 @@ class Display {
this.container.html(content); this.container.html(content);
$('.action-add-note').click(this.onActionAddNote.bind(this)); $('.action-add-note').click(this.onActionAddNote.bind(this));
$('.action-play-audio').click(this.onActionPlayAudio.bind(this)); $('.action-play-audio').click(this.onActionPlayAudio.bind(this));
$('.kanji-link').click(e => this.onKanjiSearch(e, options)); $('.kanji-link').click(e => {
e.preventDefault();
const character = $(e.target).text();
this.kanjiFind(character).then(definitions => {
this.showKanjiDefs(definitions, options, context);
}).catch(this.handleError.bind(this));
});
return this.adderButtonsUpdate(['term_kanji', 'term_kana'], sequence); return this.adderButtonsUpdate(['term_kanji', 'term_kana'], sequence);
}).catch(this.handleError.bind(this)); }).catch(this.handleError.bind(this));
} }
@ -122,14 +129,6 @@ class Display {
}); });
} }
onKanjiSearch(e, options) {
e.preventDefault();
const character = $(e.target).text();
this.kanjiFind(character).then(definitions => {
this.showKanjiDefs(definitions, options, context);
}).catch(this.handleError.bind(this));
}
onActionPlayAudio(e) { onActionPlayAudio(e) {
e.preventDefault(); e.preventDefault();
const index = $(e.currentTarget).data('index'); const index = $(e.currentTarget).data('index');