diff options
Diffstat (limited to 'ext/fg/js')
| -rw-r--r-- | ext/fg/js/driver.js | 2 | ||||
| -rw-r--r-- | ext/fg/js/frame.js | 10 | 
2 files changed, 12 insertions, 0 deletions
| diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js index 9aab7950..0c785d31 100644 --- a/ext/fg/js/driver.js +++ b/ext/fg/js/driver.js @@ -279,6 +279,8 @@ class Driver {              } else {                  alert('Note could not be added');              } + +            this.popup.invokeApi('addNoteComplete');          }).catch(error => {              alert('Error: ' + error);          }); 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}"]`); |