changeset 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 2cbafb5d5a62
children ef17a587e10d c358bdb37c13
files Core/HttpServer/FilesystemHttpHandler.cpp OrthancExplorer/explorer.js OrthancExplorer/file-upload.js OrthancExplorer/query-retrieve.js
diffstat 4 files changed, 129 insertions(+), 128 deletions(-) [+]
line wrap: on
line diff
--- a/Core/HttpServer/FilesystemHttpHandler.cpp	Sat Dec 15 16:29:50 2018 +0100
+++ b/Core/HttpServer/FilesystemHttpHandler.cpp	Mon Dec 17 10:22:51 2018 +0100
@@ -163,6 +163,7 @@
     if (SystemToolbox::IsRegularFile(p.string()))
     {
       FilesystemHttpSender sender(p);
+      sender.SetContentType(SystemToolbox::AutodetectMimeType(p.string()));
       output.Answer(sender);   // TODO COMPRESSION
     }
     else if (listDirectoryContent_ &&
--- a/OrthancExplorer/explorer.js	Sat Dec 15 16:29:50 2018 +0100
+++ b/OrthancExplorer/explorer.js	Mon Dec 17 10:22:51 2018 +0100
@@ -27,10 +27,10 @@
 
 function ChangePage(page, options)
 {
-  var first = true;
+  let first = true;
   if (options) {
-    for (var key in options) {
-      var value = options[key];
+    for (let key in options) {
+      let value = options[key];
       if (first) {
         page += '?';
         first = false;
@@ -63,7 +63,7 @@
 
 
 $(document).ready(function() {
-  var $tree = $('#dicom-tree');
+  let $tree = $('#dicom-tree');
   $tree.tree({
     autoEscape: false
   });
@@ -124,7 +124,7 @@
   if (s == undefined)
     return "No date";
 
-  var d = ParseDicomDate(s);
+  let d = ParseDicomDate(s);
   if (d == null)
     return '?';
   else
@@ -134,16 +134,16 @@
 
 function Sort(arr, fieldExtractor, isInteger, reverse)
 {
-  var defaultValue;
+  let defaultValue;
   if (isInteger)
     defaultValue = 0;
   else
     defaultValue = '';
 
   arr.sort(function(a, b) {
-    var ta = fieldExtractor(a);
-    var tb = fieldExtractor(b);
-    var order;
+    let ta = fieldExtractor(a);
+    let tb = fieldExtractor(b);
+    let order;
 
     if (ta == undefined)
       ta = defaultValue;
@@ -226,11 +226,11 @@
 
 function FormatMainDicomTags(target, tags, tagsToIgnore)
 {
-  for (var i in tags)
+  for (let i in tags)
   {
     if (tagsToIgnore.indexOf(i) == -1)
     {
-      var v = tags[i];
+      let v = tags[i];
 
       if (i == "PatientBirthDate" ||
           i == "StudyDate" ||
@@ -254,7 +254,7 @@
 
 function FormatPatient(patient, link, isReverse)
 {
-  var node = $('<div>').append($('<h3>').text(patient.MainDicomTags.PatientName));
+  let node = $('<div>').append($('<h3>').text(patient.MainDicomTags.PatientName));
 
   FormatMainDicomTags(node, patient.MainDicomTags, [ 
     "PatientName"
@@ -268,7 +268,7 @@
 
 function FormatStudy(study, link, isReverse, includePatient)
 {
-  var label;
+  let label;
 
   if (includePatient) {
     label = study.Label;
@@ -276,7 +276,7 @@
     label = study.MainDicomTags.StudyDescription;
   }
 
-  var node = $('<div>').append($('<h3>').text(label));
+  let node = $('<div>').append($('<h3>').text(label));
 
   if (includePatient) {
     FormatMainDicomTags(node, study.PatientMainDicomTags, [ 
@@ -296,7 +296,7 @@
 
 function FormatSeries(series, link, isReverse)
 {
-  var c;
+  let c;
   if (series.ExpectedNumberOfInstances == null ||
       series.Instances.length == series.ExpectedNumberOfInstances)
   {
@@ -307,7 +307,7 @@
     c = series.Instances.length + '/' + series.ExpectedNumberOfInstances;
   }
   
-  var node = $('<div>')
+  let node = $('<div>')
       .append($('<h3>').text(series.MainDicomTags.SeriesDescription))
       .append($('<p>').append($('<em>')
                            .text('Status: ')
@@ -328,7 +328,7 @@
 
 function FormatInstance(instance, link, isReverse)
 {
-  var node = $('<div>').append($('<h3>').text('Instance: ' + instance.IndexInSeries));
+  let node = $('<div>').append($('<h3>').text('Instance: ' + instance.IndexInSeries));
 
   FormatMainDicomTags(node, instance.MainDicomTags, [
     "AcquisitionNumber", 
@@ -364,7 +364,7 @@
 
 $('#lookup').live('pagebeforeshow', function() {
   // NB: "GenerateDicomDate()" is defined in "query-retrieve.js"
-  var target = $('#lookup-study-date');
+  let target = $('#lookup-study-date');
   $('option', target).remove();
   target.append($('<option>').attr('value', '*').text('Any date'));
   target.append($('<option>').attr('value', GenerateDicomDate(0)).text('Today'));
@@ -382,7 +382,7 @@
 $('#lookup-submit').live('click', function() {
   $('#lookup-result').hide();
 
-  var lookup = {
+  let lookup = {
     'Level' : 'Study',
     'Expand' : true,
     'Limit' : LIMIT_RESOURCES + 1,
@@ -432,12 +432,12 @@
 
 $('#find-patients').live('pagebeforeshow', function() {
   GetResource('/patients?expand&since=0&limit=' + (LIMIT_RESOURCES + 1), function(patients) {
-    var target = $('#all-patients');
+    let target = $('#all-patients');
     $('li', target).remove();
     
     SortOnDicomTag(patients, 'PatientName', false, false);
 
-    var count, showAlert;
+    let count, showAlert;
     if (patients.length <= LIMIT_RESOURCES) {
       count = patients.length;
       showAlert = false;
@@ -447,8 +447,8 @@
       showAlert = true;
     }
 
-    for (var i = 0; i < count; i++) {
-      var p = FormatPatient(patients[i], '#patient?uuid=' + patients[i].ID);
+    for (let i = 0; i < count; i++) {
+      let p = FormatPatient(patients[i], '#patient?uuid=' + patients[i].ID);
       target.append(p);
     }
 
@@ -467,14 +467,14 @@
 
 function FormatListOfStudies(targetId, alertId, countId, studies)
 {
-  var target = $(targetId);
+  let target = $(targetId);
   $('li', target).remove();
 
-  for (var i = 0; i < studies.length; i++) {
-    var patient = studies[i].PatientMainDicomTags.PatientName;
-    var study = studies[i].MainDicomTags.StudyDescription;
+  for (let i = 0; i < studies.length; i++) {
+    let patient = studies[i].PatientMainDicomTags.PatientName;
+    let study = studies[i].MainDicomTags.StudyDescription;
 
-    var s;
+    let s;
     if (typeof patient === 'string') {
       s = patient;
     }
@@ -493,7 +493,7 @@
   Sort(studies, function(a) { return a.Label }, false, false);
 
 
-  var count, showAlert;
+  let count, showAlert;
   if (studies.length <= LIMIT_RESOURCES) {
     count = studies.length;
     showAlert = false;
@@ -503,8 +503,8 @@
     showAlert = true;
   }
 
-  for (var i = 0; i < count; i++) {
-    var p = FormatStudy(studies[i], '#study?uuid=' + studies[i].ID, false, true);
+  for (let i = 0; i < count; i++) {
+    let p = FormatStudy(studies[i], '#study?uuid=' + studies[i].ID, false, true);
     target.append(p);
   }
 
@@ -547,7 +547,7 @@
 function RefreshPatient()
 {
   if ($.mobile.pageData) {
-    var pageData = DeepCopy($.mobile.pageData);
+    let pageData = DeepCopy($.mobile.pageData);
 
     GetResource('/patients/' + pageData.uuid, function(patient) {
       GetResource('/patients/' + pageData.uuid + '/studies', function(studies) {
@@ -559,10 +559,10 @@
           .append(FormatPatient(patient))
           .listview('refresh');
 
-        var target = $('#list-studies');
+        let target = $('#list-studies');
         $('li', target).remove();
         
-        for (var i = 0; i < studies.length; i++) {
+        for (let i = 0; i < studies.length; i++) {
           if (i == 0 || studies[i].MainDicomTags.StudyDate != studies[i - 1].MainDicomTags.StudyDate)
           {
             target.append($('<li>')
@@ -586,7 +586,7 @@
           async: false,
           cache: false,
           success: function (s) {
-            var v = (s == '1') ? 'on' : 'off';
+            let v = (s == '1') ? 'on' : 'off';
             $('#protection').val(v).slider('refresh');
           }
         });
@@ -602,7 +602,7 @@
 function RefreshStudy()
 {
   if ($.mobile.pageData) {
-    var pageData = DeepCopy($.mobile.pageData);
+    let pageData = DeepCopy($.mobile.pageData);
 
     GetResource('/studies/' + pageData.uuid, function(study) {
       GetResource('/patients/' + study.ParentPatient, function(patient) {
@@ -621,9 +621,9 @@
           SetupAnonymizedOrModifiedFrom('#study-anonymized-from', study, 'study', 'AnonymizedFrom');
           SetupAnonymizedOrModifiedFrom('#study-modified-from', study, 'study', 'ModifiedFrom');
 
-          var target = $('#list-series');
+          let target = $('#list-series');
           $('li', target).remove();
-          for (var i = 0; i < series.length; i++) {
+          for (let i = 0; i < series.length; i++) {
             if (i == 0 || series[i].MainDicomTags.SeriesDate != series[i - 1].MainDicomTags.SeriesDate)
             {
               target.append($('<li>')
@@ -647,7 +647,7 @@
 function RefreshSeries() 
 {
   if ($.mobile.pageData) {
-    var pageData = DeepCopy($.mobile.pageData);
+    let pageData = DeepCopy($.mobile.pageData);
 
     GetResource('/series/' + pageData.uuid, function(series) {
       GetResource('/studies/' + series.ParentStudy, function(study) {
@@ -671,9 +671,9 @@
             SetupAnonymizedOrModifiedFrom('#series-anonymized-from', series, 'series', 'AnonymizedFrom');
             SetupAnonymizedOrModifiedFrom('#series-modified-from', series, 'series', 'ModifiedFrom');
 
-            var target = $('#list-instances');
+            let target = $('#list-instances');
             $('li', target).remove();
-            for (var i = 0; i < instances.length; i++) {
+            for (let i = 0; i < instances.length; i++) {
               target.append(FormatInstance(instances[i], '#instance?uuid=' + instances[i].ID));
             }
             target.listview('refresh');
@@ -690,7 +690,7 @@
 
 function EscapeHtml(value)
 {
-  var ENTITY_MAP = {
+  let ENTITY_MAP = {
     '&': '&amp;',
     '<': '&lt;',
     '>': '&gt;',
@@ -709,11 +709,11 @@
 
 function ConvertForTree(dicom)
 {
-  var result = [];
+  let result = [];
 
-  for (var i in dicom) {
+  for (let i in dicom) {
     if (dicom[i] != null) {
-      var label = (i + '<span class="tag-name"> (<i>' +
+      let label = (i + '<span class="tag-name"> (<i>' +
                    EscapeHtml(dicom[i]["Name"]) +
                    '</i>)</span>: ');
 
@@ -740,8 +740,8 @@
       }
       else if (dicom[i]["Type"] == 'Sequence')
       {
-        var c = [];
-        for (var j = 0; j < dicom[i]["Value"].length; j++) {
+        let c = [];
+        for (let j = 0; j < dicom[i]["Value"].length; j++) {
           c.push({
             label: 'Item ' + j,
             children: ConvertForTree(dicom[i]["Value"][j])
@@ -763,7 +763,7 @@
 function RefreshInstance()
 {
   if ($.mobile.pageData) {
-    var pageData = DeepCopy($.mobile.pageData);
+    let pageData = DeepCopy($.mobile.pageData);
 
     GetResource('/instances/' + pageData.uuid, function(instance) {
       GetResource('/series/' + instance.ParentSeries, function(series) {
@@ -837,7 +837,7 @@
     dataType: 'json',
     async: false,
     success: function(s) {
-      var ancestor = s.RemainingAncestor;
+      let ancestor = s.RemainingAncestor;
       if (ancestor == null)
         $.mobile.changePage('#lookup');
       else
@@ -913,9 +913,9 @@
 
 $('#instance-preview').live('click', function(e) {
   if ($.mobile.pageData) {
-    var pageData = DeepCopy($.mobile.pageData);
+    let pageData = DeepCopy($.mobile.pageData);
 
-    var pdf = '../instances/' + pageData.uuid + '/pdf';
+    let pdf = '../instances/' + pageData.uuid + '/pdf';
     $.ajax({
       url: pdf,
       cache: false,
@@ -937,8 +937,8 @@
           {
             // Viewing a multi-frame image
 
-            var images = [];
-            for (var i = 0; i < frames.length; i++) {
+            let images = [];
+            for (let i = 0; i < frames.length; i++) {
               images.push([ '../instances/' + pageData.uuid + '/frames/' + i + '/preview' ]);
             }
 
@@ -959,14 +959,14 @@
 
 $('#series-preview').live('click', function(e) {
   if ($.mobile.pageData) {
-    var pageData = DeepCopy($.mobile.pageData);
+    let pageData = DeepCopy($.mobile.pageData);
 
     GetResource('/series/' + pageData.uuid, function(series) {
       GetResource('/series/' + pageData.uuid + '/instances', function(instances) {
         Sort(instances, function(x) { return x.IndexInSeries; }, true, false);
 
-        var images = [];
-        for (var i = 0; i < instances.length; i++) {
+        let images = [];
+        for (let i = 0; i < instances.length; i++) {
           images.push([ '../instances/' + instances[i].ID + '/preview',
                         (i + 1).toString() + '/' + instances.length.toString() ])
         }
@@ -988,9 +988,9 @@
 
 function ChooseDicomModality(callback)
 {
-  var clickedModality = '';
-  var clickedPeer = '';
-  var items = $('<ul>')
+  let clickedModality = '';
+  let clickedPeer = '';
+  let items = $('<ul>')
     .attr('data-divider-theme', 'd')
     .attr('data-role', 'listview');
 
@@ -1006,9 +1006,9 @@
       {
         items.append('<li data-role="list-divider">DICOM modalities</li>');
 
-        for (var i = 0; i < modalities.length; i++) {
-          var name = modalities[i];
-          var item = $('<li>')
+        for (let i = 0; i < modalities.length; i++) {
+          let name = modalities[i];
+          let item = $('<li>')
             .html('<a href="#" rel="close">' + name + '</a>')
             .attr('name', name)
             .click(function() { 
@@ -1030,9 +1030,9 @@
           {
             items.append('<li data-role="list-divider">Orthanc peers</li>');
 
-            for (var i = 0; i < peers.length; i++) {
-              var name = peers[i];
-              var item = $('<li>')
+            for (let i = 0; i < peers.length; i++) {
+              let name = peers[i];
+              let item = $('<li>')
                 .html('<a href="#" rel="close">' + name + '</a>')
                 .attr('name', name)
                 .click(function() { 
@@ -1052,7 +1052,7 @@
             width: '100%',
             blankContent: items,
             callbackClose: function() {
-              var timer;
+              let timer;
               function WaitForDialogToClose() {
                 if (!$('#dialog').is(':visible')) {
                   clearInterval(timer);
@@ -1071,10 +1071,10 @@
 
 $('#instance-store,#series-store,#study-store,#patient-store').live('click', function(e) {
   ChooseDicomModality(function(modality, peer) {
-    var pageData = DeepCopy($.mobile.pageData);
+    let pageData = DeepCopy($.mobile.pageData);
 
-    var url;
-    var loading;
+    let url;
+    let loading;
 
     if (modality != '')
     {
@@ -1113,7 +1113,7 @@
 
 
 $('#show-tag-name').live('change', function(e) {
-  var checked = e.currentTarget.checked;
+  let checked = e.currentTarget.checked;
   if (checked)
     $('.tag-name').show();
   else
@@ -1155,7 +1155,7 @@
 
 
 $('#protection').live('change', function(e) {
-  var isProtected = e.target.value == "on";
+  let isProtected = e.target.value == "on";
   $.ajax({
     url: '../patients/' + $.mobile.pageData.uuid + '/protected',
     type: 'PUT',
@@ -1233,7 +1233,7 @@
     async: false,
     cache: false,
     success: function(plugins) {
-      var target = $('#all-plugins');
+      let target = $('#all-plugins');
       $('li', target).remove();
 
       plugins.map(function(id) {
@@ -1243,8 +1243,8 @@
           async: false,
           cache: false,
           success: function(plugin) {
-            var li = $('<li>');
-            var item = li;
+            let li = $('<li>');
+            let item = li;
 
             if ('RootUri' in plugin)
             {
@@ -1272,12 +1272,12 @@
 
 function ParseJobTime(s)
 {
-  var t = (s.substr(0, 4) + '-' +
+  let t = (s.substr(0, 4) + '-' +
            s.substr(4, 2) + '-' +
            s.substr(6, 5) + ':' +
            s.substr(11, 2) + ':' +
            s.substr(13));
-  var utc = new Date(t);
+  let utc = new Date(t);
 
   // Convert from UTC to local time
   return new Date(utc.getTime() - utc.getTimezoneOffset() * 60000);
@@ -1311,18 +1311,18 @@
     async: false,
     cache: false,
     success: function(jobs) {
-      var target = $('#all-jobs');
+      let target = $('#all-jobs');
       $('li', target).remove();
 
-      var running = $('<li>')
+      let running = $('<li>')
           .attr('data-role', 'list-divider')
           .text('Currently running');
 
-      var pending = $('<li>')
+      let pending = $('<li>')
           .attr('data-role', 'list-divider')
           .text('Pending jobs');
 
-      var inactive = $('<li>')
+      let inactive = $('<li>')
           .attr('data-role', 'list-divider')
           .text('Inactive jobs');
 
@@ -1331,8 +1331,8 @@
       target.append(inactive);
 
       jobs.map(function(job) {
-        var li = $('<li>');
-        var item = $('<a>');
+        let li = $('<li>');
+        let item = $('<a>');
         li.append(item);
         item.attr('href', '#job?uuid=' + job.ID);
         item.append($('<h1>').text(job.Type));
@@ -1369,7 +1369,7 @@
 
 $('#job').live('pagebeforeshow', function() {
   if ($.mobile.pageData) {
-    var pageData = DeepCopy($.mobile.pageData);
+    let pageData = DeepCopy($.mobile.pageData);
 
     $.ajax({
       url: '../jobs/' + pageData.uuid,
@@ -1377,15 +1377,15 @@
       async: false,
       cache: false,
       success: function(job) {
-        var target = $('#job-info');
+        let target = $('#job-info');
         $('li', target).remove();
 
         target.append($('<li>')
                       .attr('data-role', 'list-divider')
                       .text('General information about the job'));
 
-        var block = $('<li>');
-        for (var i in job) {
+        let block = $('<li>');
+        for (let i in job) {
           if (i == 'CreationTime' ||
               i == 'CompletionTime' ||
               i == 'EstimatedTimeOfArrival') {
@@ -1403,10 +1403,10 @@
                       .attr('data-role', 'list-divider')
                       .text('Detailed information'));
 
-        var block = $('<li>');
+        let block = $('<li>');
 
-        for (var item in job.Content) {
-          var value = job.Content[item];
+        for (let item in job.Content) {
+          let value = job.Content[item];
           if (typeof value !== 'string') {
             value = JSON.stringify(value);
           }
--- a/OrthancExplorer/file-upload.js	Sat Dec 15 16:29:50 2018 +0100
+++ b/OrthancExplorer/file-upload.js	Mon Dec 17 10:22:51 2018 +0100
@@ -27,7 +27,7 @@
       $('#progress .label').text('Failure');
     })
     .bind('fileuploaddrop', function (e, data) {
-      var target = $('#upload-list');
+      let target = $('#upload-list');
       $.each(data.files, function (index, file) {
         target.append('<li class="pending-file">' + file.name + '</li>');
       });
@@ -36,7 +36,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);
+      let progress = parseInt(currentUpload / totalUploads * 100, 10);
       currentUpload += 1;
       $('#progress .label').text('Uploading: ' + progress + '%');
       $('#progress .bar')
@@ -62,7 +62,7 @@
 
 
 $('#upload-button').live('click', function() {
-  var pu = pendingUploads;
+  let pu = pendingUploads;
   pendingUploads = [];
 
   $('.pending-file').remove();
@@ -77,7 +77,7 @@
     //$('#upload-abort').removeClass('ui-disabled');
   }
 
-  for (var i = 0; i < pu.length; i++) {
+  for (let i = 0; i < pu.length; i++) {
     pu[i].submit();
   }
 });
--- a/OrthancExplorer/query-retrieve.js	Sat Dec 15 16:29:50 2018 +0100
+++ b/OrthancExplorer/query-retrieve.js	Mon Dec 17 10:22:51 2018 +0100
@@ -1,13 +1,13 @@
 function JavascriptDateToDicom(date)
 {
-  var s = date.toISOString();
+  let s = date.toISOString();
   return s.substring(0, 4) + s.substring(5, 7) + s.substring(8, 10);
 }
 
 function GenerateDicomDate(days)
 {
-  var today = new Date();
-  var other = new Date(today);
+  let today = new Date();
+  let other = new Date(today);
   other.setDate(today.getDate() + days);
   return JavascriptDateToDicom(other);
 }
@@ -20,11 +20,11 @@
     async: false,
     cache: false,
     success: function(modalities) {
-      var target = $('#qr-server');
+      let target = $('#qr-server');
       $('option', target).remove();
 
-      for (var i = 0; i < modalities.length; i++) {
-        var option = $('<option>').text(modalities[i]);
+      for (let i = 0; i < modalities.length; i++) {
+        let option = $('<option>').text(modalities[i]);
         target.append(option);
       }
 
@@ -32,7 +32,7 @@
     }
   });
 
-  var target = $('#qr-date');
+  let target = $('#qr-date');
   $('option', target).remove();
   target.append($('<option>').attr('value', '*').text('Any date'));
   target.append($('<option>').attr('value', GenerateDicomDate(0)).text('Today'));
@@ -46,8 +46,8 @@
 
 
 $('#qr-echo').live('click', function() {
-  var server = $('#qr-server').val();
-  var message = 'Error: The C-Echo has failed!';
+  let server = $('#qr-server').val();
+  let message = 'Error: The C-Echo has failed!';
 
   $.ajax({
     url: '../modalities/' + server + '/echo',
@@ -75,7 +75,7 @@
 
 
 $('#qr-submit').live('click', function() {
-  var query = {
+  let query = {
     'Level' : 'Study',
     'Query' : {
       'AccessionNumber' : '*',
@@ -88,12 +88,12 @@
     }
   };
 
-  var field = $('#qr-fields input:checked').val();
+  let field = $('#qr-fields input:checked').val();
   query['Query'][field] = $('#qr-value').val().toUpperCase();
 
-  var modalities = '';
+  let modalities = '';
   $('#qr-modalities input:checked').each(function() {
-    var s = $(this).attr('name');
+    let s = $(this).attr('name');
     if (modalities == '')
       modalities = s;
     else
@@ -105,7 +105,7 @@
   }
 
 
-  var server = $('#qr-server').val();
+  let server = $('#qr-server').val();
   $.ajax({
     url: '../modalities/' + server + '/query',
     type: 'POST', 
@@ -130,27 +130,27 @@
 
 $('#query-retrieve-2').live('pagebeforeshow', function() {
   if ($.mobile.pageData) {
-    var pageData = DeepCopy($.mobile.pageData);
+    let pageData = DeepCopy($.mobile.pageData);
 
-    var uri = '../queries/' + pageData.uuid + '/answers';
+    let uri = '../queries/' + pageData.uuid + '/answers';
 
     $.ajax({
       url: uri,
       dataType: 'json',
       async: false,
       success: function(answers) {
-        var target = $('#query-retrieve-2 ul');
+        let target = $('#query-retrieve-2 ul');
         $('li', target).remove();
 
-        for (var i = 0; i < answers.length; i++) {
+        for (let i = 0; i < answers.length; i++) {
           $.ajax({
             url: uri + '/' + answers[i] + '/content?simplify',
             dataType: 'json',
             async: false,
             success: function(study) {
-              var series = '#query-retrieve-3?server=' + pageData.server + '&uuid=' + study['StudyInstanceUID'];
+              let series = '#query-retrieve-3?server=' + pageData.server + '&uuid=' + study['StudyInstanceUID'];
 
-              var content = ($('<div>')
+              let content = ($('<div>')
                              .append($('<h3>').text(study['PatientID'] + ' - ' + study['PatientName']))
                              .append($('<p>').text('Accession number: ')
                                      .append($('<b>').text(study['AccessionNumber'])))
@@ -163,10 +163,10 @@
                              .append($('<p>').text('Study date: ')
                                      .append($('<b>').text(FormatDicomDate(study['StudyDate'])))));
 
-              var info = $('<a>').attr('href', series).html(content);
+              let info = $('<a>').attr('href', series).html(content);
               
-              var answerId = answers[i];
-              var retrieve = $('<a>').text('Retrieve all study').click(function() {
+              let answerId = answers[i];
+              let retrieve = $('<a>').text('Retrieve all study').click(function() {
                 ChangePage('query-retrieve-4', {
                   'query' : pageData.uuid,
                   'answer' : answerId,
@@ -188,9 +188,9 @@
 
 $('#query-retrieve-3').live('pagebeforeshow', function() {
   if ($.mobile.pageData) {
-    var pageData = DeepCopy($.mobile.pageData);
+    let pageData = DeepCopy($.mobile.pageData);
 
-    var query = {
+    let query = {
       'Level' : 'Series',
       'Query' : {
         'Modality' : '*',
@@ -211,8 +211,8 @@
         alert('Error during query (C-Find)');
       },
       success: function(answer) {
-        var queryUuid = answer['ID'];
-        var uri = '../queries/' + answer['ID'] + '/answers';
+        let queryUuid = answer['ID'];
+        let uri = '../queries/' + answer['ID'] + '/answers';
 
         $.ajax({
           url: uri,
@@ -220,25 +220,25 @@
           async: false,
           success: function(answers) {
             
-            var target = $('#query-retrieve-3 ul');
+            let target = $('#query-retrieve-3 ul');
             $('li', target).remove();
 
-            for (var i = 0; i < answers.length; i++) {
+            for (let i = 0; i < answers.length; i++) {
               $.ajax({
                 url: uri + '/' + answers[i] + '/content?simplify',
                 dataType: 'json',
                 async: false,
                 success: function(series) {
-                  var content = ($('<div>')
+                  let content = ($('<div>')
                                  .append($('<h3>').text(series['SeriesDescription']))
                                  .append($('<p>').text('Modality: ')
                                          .append($('<b>').text(series['Modality'])))
                                  .append($('<p>').text('ProtocolName: ')
                                          .append($('<b>').text(series['ProtocolName']))));
 
-                  var info = $('<a>').html(content);
+                  let info = $('<a>').html(content);
 
-                  var answerId = answers[i];
+                  let answerId = answers[i];
                   info.click(function() {
                     ChangePage('query-retrieve-4', {
                       'query' : queryUuid,
@@ -265,8 +265,8 @@
 
 $('#query-retrieve-4').live('pagebeforeshow', function() {
   if ($.mobile.pageData) {
-    var pageData = DeepCopy($.mobile.pageData);
-    var uri = '../queries/' + pageData.query + '/answers/' + pageData.answer + '/retrieve';
+    let pageData = DeepCopy($.mobile.pageData);
+    let uri = '../queries/' + pageData.query + '/answers/' + pageData.answer + '/retrieve';
 
     $.ajax({
       url: '../system',
@@ -279,7 +279,7 @@
         $('#retrieve-form').submit(function(event) {
           event.preventDefault();
 
-          var aet = $('#retrieve-target').val();
+          let aet = $('#retrieve-target').val();
           if (aet.length == 0) {
             aet = system['DicomAet'];
           }