From eeec67f5f0577fc38edb0e1312f0fdfcf6c43088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20V=C3=A9ril?= Date: Mon, 7 Oct 2019 11:22:44 +0200 Subject: [PATCH] Add an indicator when processing (a wait cursor) --- content/multipledataset.html | 9 +++++++++ content/onedataset.html | 4 ++++ static/js/processingIndicator.js | 15 +++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 static/js/processingIndicator.js diff --git a/content/multipledataset.html b/content/multipledataset.html index 4a822be8..c48d324d 100644 --- a/content/multipledataset.html +++ b/content/multipledataset.html @@ -9,6 +9,7 @@ draft: false + diff --git a/content/onedataset.html b/content/onedataset.html index fcb52063..dddd037f 100644 --- a/content/onedataset.html +++ b/content/onedataset.html @@ -38,6 +38,7 @@ draft: false update_ZPE(window.dats["ZPE"][event.target.value]) } async function update_mol(molecule){ + processingIndicator.isActive=true for (const [key,dat] of Object.entries(window.dats)) { var s=document.getElementById(String.raw`select_${key}`) $(s).find('option[value!=""]').remove() @@ -52,6 +53,7 @@ draft: false } }) } + processingIndicator.isActive=false } async function update_abs(abs){ window.data.Abs=abs @@ -72,6 +74,7 @@ draft: false } async function reload() { + processingIndicator.isActive=true clear() const LatexInline=['\\(','\\)'] var par=document.getElementById("data_par") @@ -143,6 +146,7 @@ draft: false await MathJax.typesetPromise(); document.getElementById("ex_div").hidden=false await MathJax.typesetPromise(); + processingIndicator.isActive=false }

diff --git a/static/js/processingIndicator.js b/static/js/processingIndicator.js new file mode 100644 index 00000000..1827b099 --- /dev/null +++ b/static/js/processingIndicator.js @@ -0,0 +1,15 @@ +class processingIndicator{ + static get isActive(){ + return document.body.style.cursor==="wait" + } + static set isActive(value){ + if(value!=this.isActive){ + if(value){ + document.body.style.cursor="wait" + } + else{ + document.body.style.cursor="default" + } + } + } +} \ No newline at end of file