2020-11-02 Fred Gleason <fredg@paravelsystems.com>

* Added a 'donut-spinner' indicator to Webget.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2020-11-02 10:57:33 -05:00
parent 7a14cf44b2
commit 7d87f6e93f
6 changed files with 13 additions and 6 deletions

View File

@@ -32,7 +32,7 @@ function ProcessGet()
form.append('title',Id('title').value);
form.append('preset',Id('preset').value);
SendForm(form,"webget.cgi");
SendForm(form,'webget.cgi','get_spinner');
}
@@ -46,11 +46,11 @@ function ProcessPut()
form.append('group',Id('group').value);
form.append('filename',Id('filename').files[0]);
SendForm(form,"webget.cgi");
SendForm(form,'webget.cgi','put_spinner');
}
function SendForm(form,url)
function SendForm(form,url,spinner_id)
{
var http=new XMLHttpRequest();
if(http==null) {
@@ -60,6 +60,7 @@ function SendForm(form,url)
//
// Send the form
//
Id(spinner_id).innerHTML='<img src="/rd-bin/donut-spinner.gif">';
http.open("POST",url,true);
http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
http.responseType='blob';
@@ -69,7 +70,7 @@ function SendForm(form,url)
// Process the response
//
http.onload=function(e) {
Id(spinner_id).innerHTML='';
var blob=new Blob([this.response],
{type: http.getResponseHeader('content-type')});
var f0=blob.type.split(';');