Mercurial > hg > orthanc
changeset 3110:7047222cfa96
minor improvements to upload progress bar
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 11 Jan 2019 10:55:18 +0100 |
parents | 6aa8d90aeee5 |
children | 495ec3d3893d |
files | OrthancExplorer/file-upload.js |
diffstat | 1 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancExplorer/file-upload.js Fri Jan 11 10:46:16 2019 +0100 +++ b/OrthancExplorer/file-upload.js Fri Jan 11 10:55:18 2019 +0100 @@ -3,6 +3,8 @@ var totalUpload = 0; $(document).ready(function() { + var progress; + // Initialize the jQuery File Upload widget: $('#fileupload').fileupload({ //dataType: 'json', @@ -33,7 +35,7 @@ .bind('fileuploadsend', function (e, data) { // Update the progress bar. Note: for some weird reason, the // "fileuploadprogressall" does not work under Firefox. - var progress = parseInt(currentUpload / totalUploads * 100, 10); + progress = parseInt(currentUpload / totalUploads * 100, 10); currentUpload += 1; $('#progress .label').text('Uploading: ' + progress + '%'); $('#progress .bar') @@ -54,11 +56,22 @@ appendFilesToUploadList(e.target.files); }) -$('#upload').live('pageshow', function() { + +function ClearUploadProgress() +{ + $('#progress .label').text(''); + $('#progress .bar').css('width', '0%').css('background-color', '#333'); +} + +$('#upload').live('pagebeforeshow', function() { if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) { $("#issue-21-warning").css('display', 'none'); } + ClearUploadProgress(); +}); + +$('#upload').live('pageshow', function() { $('#fileupload').fileupload('enable'); }); @@ -73,8 +86,7 @@ $('.pending-file').remove(); $('#upload-list').listview('refresh'); - $('#progress .bar').css('width', '0%'); - $('#progress .label').text(''); + ClearUploadProgress(); currentUpload = 1; totalUploads = pu.length + 1;