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.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js
index f25ae8da..5878bb43 100644
--- a/ext/fg/js/frame.js
+++ b/ext/fg/js/frame.js
@@ -21,6 +21,11 @@ function invokeApi(action, params, target) {
target.postMessage({action, params}, '*');
}
+function showSpinner(show) {
+ const spinner = document.querySelector('.spinner');
+ spinner.style.visibility = show ? 'visible' : 'hidden';
+}
+
function registerKanjiLinks() {
for (const link of Array.from(document.getElementsByClassName('kanji-link'))) {
link.addEventListener('click', e => {
@@ -36,6 +41,7 @@ function registerAddNoteLinks() {
e.preventDefault();
const ds = e.currentTarget.dataset;
invokeApi('addNote', {index: ds.index, mode: ds.mode}, window.parent);
+ showSpinner(true);
});
}
}
@@ -50,6 +56,10 @@ function registerAudioLinks() {
}
}
+function api_addNoteComplete() {
+ showSpinner(false);
+}
+
function api_setActionState({index, state, sequence}) {
for (const mode in state) {
const matches = document.querySelectorAll(`.action-bar[data-sequence="${sequence}"] .action-add-note[data-index="${index}"][data-mode="${mode}"]`);