comparison OrthancExplorer/file-upload.js @ 3023:c9c2faf76bec

replaced 'var' by 'let' in Orthanc Explorer's JavaScript
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 Dec 2018 10:22:51 +0100
parents 79d259b86aa9
children 5713952f60c0 9b18c8d4d459
comparison
equal deleted inserted replaced
3021:2cbafb5d5a62 3023:c9c2faf76bec
25 .css('width', '100%') 25 .css('width', '100%')
26 .css('background-color', 'red'); 26 .css('background-color', 'red');
27 $('#progress .label').text('Failure'); 27 $('#progress .label').text('Failure');
28 }) 28 })
29 .bind('fileuploaddrop', function (e, data) { 29 .bind('fileuploaddrop', function (e, data) {
30 var target = $('#upload-list'); 30 let target = $('#upload-list');
31 $.each(data.files, function (index, file) { 31 $.each(data.files, function (index, file) {
32 target.append('<li class="pending-file">' + file.name + '</li>'); 32 target.append('<li class="pending-file">' + file.name + '</li>');
33 }); 33 });
34 target.listview('refresh'); 34 target.listview('refresh');
35 }) 35 })
36 .bind('fileuploadsend', function (e, data) { 36 .bind('fileuploadsend', function (e, data) {
37 // Update the progress bar. Note: for some weird reason, the 37 // Update the progress bar. Note: for some weird reason, the
38 // "fileuploadprogressall" does not work under Firefox. 38 // "fileuploadprogressall" does not work under Firefox.
39 var progress = parseInt(currentUpload / totalUploads * 100, 10); 39 let progress = parseInt(currentUpload / totalUploads * 100, 10);
40 currentUpload += 1; 40 currentUpload += 1;
41 $('#progress .label').text('Uploading: ' + progress + '%'); 41 $('#progress .label').text('Uploading: ' + progress + '%');
42 $('#progress .bar') 42 $('#progress .bar')
43 .css('width', progress + '%') 43 .css('width', progress + '%')
44 .css('background-color', 'green'); 44 .css('background-color', 'green');
60 $('#fileupload').fileupload('disable'); 60 $('#fileupload').fileupload('disable');
61 }); 61 });
62 62
63 63
64 $('#upload-button').live('click', function() { 64 $('#upload-button').live('click', function() {
65 var pu = pendingUploads; 65 let pu = pendingUploads;
66 pendingUploads = []; 66 pendingUploads = [];
67 67
68 $('.pending-file').remove(); 68 $('.pending-file').remove();
69 $('#upload-list').listview('refresh'); 69 $('#upload-list').listview('refresh');
70 $('#progress .bar').css('width', '0%'); 70 $('#progress .bar').css('width', '0%');
75 if (pu.length > 0) { 75 if (pu.length > 0) {
76 $('#upload-button').addClass('ui-disabled'); 76 $('#upload-button').addClass('ui-disabled');
77 //$('#upload-abort').removeClass('ui-disabled'); 77 //$('#upload-abort').removeClass('ui-disabled');
78 } 78 }
79 79
80 for (var i = 0; i < pu.length; i++) { 80 for (let i = 0; i < pu.length; i++) {
81 pu[i].submit(); 81 pu[i].submit();
82 } 82 }
83 }); 83 });
84 84
85 $('#upload-clear').live('click', function() { 85 $('#upload-clear').live('click', function() {