aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/frame.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js/frame.js')
-rw-r--r--ext/fg/js/frame.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js
index 95762d5e..fc32a718 100644
--- a/ext/fg/js/frame.js
+++ b/ext/fg/js/frame.js
@@ -61,6 +61,37 @@ class Frame {
});
}
+ api_showTermGroupedDefs({definitions, options}) {
+ const sequence = ++this.sequence;
+ const context = {
+ definitions,
+ addable: options.ankiMethod !== 'disabled',
+ playback: options.enableAudioPlayback
+ };
+
+ this.definitions = definitions;
+ this.showSpinner(false);
+ window.scrollTo(0, 0);
+
+ renderText(context, 'term-list.html').then(content => {
+ $('.content').html(content);
+ $('.action-add-note').click(this.onAddNote.bind(this));
+
+ $('.kanji-link').click(e => {
+ e.preventDefault();
+ findKanji($(e.target).text()).then(kdefs => this.api_showKanjiDefs({options, definitions: kdefs}));
+ });
+
+ $('.action-play-audio').click(e => {
+ e.preventDefault();
+ const index = $(e.currentTarget).data('index');
+ this.playAudio(this.definitions[index]);
+ });
+
+ this.updateAddNoteButtons(['term_kanji', 'term_kana'], sequence);
+ });
+ }
+
api_showKanjiDefs({definitions, options}) {
const sequence = ++this.sequence;
const context = {