comparison OrthancExplorer/explorer.js @ 3066:5713952f60c0 update-jquery

upgraded jquery, jquery-mobile, jquery-file-upload. Everything seems to be working as before. Theme has changed !
author am@osimis.io
date Wed, 26 Dec 2018 16:58:21 +0100
parents b89a4288d605
children
comparison
equal deleted inserted replaced
3065:b89a4288d605 3066:5713952f60c0
1 // http://stackoverflow.com/questions/1663741/is-there-a-good-jquery-drag-and-drop-file-upload-plugin 1 // http://stackoverflow.com/questions/1663741/is-there-a-good-jquery-drag-and-drop-file-upload-plugin
2 2
3 3
4 // Forbid the access to IE 4 //detect browser (from https://stackoverflow.com/questions/5916900/how-can-you-detect-the-version-of-a-browser)
5 if ($.browser.msie) 5 navigator.browserSpecs = (function(){
6 { 6 var ua = navigator.userAgent, tem,
7 alert("Please use Mozilla Firefox or Google Chrome. Microsoft Internet Explorer is not supported."); 7 M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
8 if(/trident/i.test(M[1])){
9 tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
10 return {name:'IE',version:(tem[1] || '')};
11 }
12 if(M[1]=== 'Chrome'){
13 tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
14 if(tem != null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};
15 }
16 M = M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
17 if((tem = ua.match(/version\/(\d+)/i))!= null)
18 M.splice(1, 1, tem[1]);
19 return {name:M[0], version:M[1]};
20 })();
21
22 if (navigator.browserSpecs.name == 'IE' && navigator.browserSpecs.version < 11) {
23 alert("Your version of Internet Explorer is not supported. Please use Mozilla Firefox or Google Chrome.");
8 } 24 }
9 25
10 // http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html 26 // http://jquerymobile.com/demos/1.1.0/docs/api/globalconfig.html
11 //$.mobile.ajaxEnabled = false; 27 //$.mobile.ajaxEnabled = false;
12 //$.mobile.page.prototype.options.addBackBtn = true; 28 //$.mobile.page.prototype.options.addBackBtn = true;
76 else 92 else
77 $tree.tree('openNode', event.node, true); 93 $tree.tree('openNode', event.node, true);
78 } 94 }
79 ); 95 );
80 96
81 currentPage = $.mobile.pageData.active; 97 if (!(typeof $.mobile.pageData === 'undefined')) {
82 currentUuid = $.mobile.pageData.uuid; 98
83 if (!(typeof currentPage === 'undefined') && 99 currentPage = $.mobile.pageData.active;
84 !(typeof currentUuid === 'undefined') && 100 currentUuid = $.mobile.pageData.uuid;
85 currentPage.length > 0 && 101 if (!(typeof currentPage === 'undefined') &&
86 currentUuid.length > 0) 102 !(typeof currentUuid === 'undefined') &&
87 { 103 currentPage.length > 0 &&
88 Refresh(); 104 currentUuid.length > 0)
105 {
106 Refresh();
107 }
89 } 108 }
90 }); 109 });
91 110
92 111
93 function SplitLongUid(s) 112 function SplitLongUid(s)
340 359
341 return CompleteFormatting(node, link, isReverse); 360 return CompleteFormatting(node, link, isReverse);
342 } 361 }
343 362
344 363
345 $('[data-role="page"]').live('pagebeforeshow', function() { 364 $(document).on("pagebeforeshow", '[data-role="page"]', function() {
346 $.ajax({ 365 $.ajax({
347 url: '../system', 366 url: '../system',
348 dataType: 'json', 367 dataType: 'json',
349 async: false, 368 async: false,
350 cache: false, 369 cache: false,
360 }); 379 });
361 }); 380 });
362 381
363 382
364 383
365 $('#lookup').live('pagebeforeshow', function() { 384 $(document).on("pagebeforeshow", "#lookup", function() {
366 // NB: "GenerateDicomDate()" is defined in "query-retrieve.js" 385 // NB: "GenerateDicomDate()" is defined in "query-retrieve.js"
367 let target = $('#lookup-study-date'); 386 let target = $('#lookup-study-date');
368 $('option', target).remove(); 387 $('option', target).remove();
369 target.append($('<option>').attr('value', '*').text('Any date')); 388 target.append($('<option>').attr('value', '*').text('Any date'));
370 target.append($('<option>').attr('value', GenerateDicomDate(0)).text('Today')); 389 target.append($('<option>').attr('value', GenerateDicomDate(0)).text('Today'));
377 396
378 $('#lookup-result').hide(); 397 $('#lookup-result').hide();
379 }); 398 });
380 399
381 400
382 $('#lookup-submit').live('click', function() { 401 $(document).on("click", "#lookup-submit", function(e) {
383 $('#lookup-result').hide(); 402 $('#lookup-result').hide();
384 403
385 let lookup = { 404 let lookup = {
386 'Level' : 'Study', 405 'Level' : 'Study',
387 'Expand' : true, 406 'Expand' : true,
428 447
429 return false; 448 return false;
430 }); 449 });
431 450
432 451
433 $('#find-patients').live('pagebeforeshow', function() { 452 $(document).on("pagebeforeshow", "#find-patients", function() {
434 GetResource('/patients?expand&since=0&limit=' + (LIMIT_RESOURCES + 1), function(patients) { 453 GetResource('/patients?expand&since=0&limit=' + (LIMIT_RESOURCES + 1), function(patients) {
435 let target = $('#all-patients'); 454 let target = $('#all-patients');
436 $('li', target).remove(); 455 $('li', target).remove();
437 456
438 SortOnDicomTag(patients, 'PatientName', false, false); 457 SortOnDicomTag(patients, 'PatientName', false, false);
516 } else { 535 } else {
517 $(alertId).hide(); 536 $(alertId).hide();
518 } 537 }
519 } 538 }
520 539
521 540 $(document).on("pagebeforeshow", "#find-studies", function() {
522 $('#find-studies').live('pagebeforeshow', function() {
523 GetResource('/studies?expand&since=0&limit=' + (LIMIT_RESOURCES + 1), function(studies) { 541 GetResource('/studies?expand&since=0&limit=' + (LIMIT_RESOURCES + 1), function(studies) {
524 FormatListOfStudies('#all-studies', '#alert-studies', '#count-studies', studies); 542 FormatListOfStudies('#all-studies', '#alert-studies', '#count-studies', studies);
525 }); 543 });
526 }); 544 });
527 545
800 }); 818 });
801 }); 819 });
802 } 820 }
803 } 821 }
804 822
805 $(document).live('pagebeforehide', function() { 823 $(document).on('pagebeforehide', function() {
806 currentPage = ''; 824 currentPage = '';
807 currentUuid = ''; 825 currentUuid = '';
808 }); 826 });
809 827
810 828
811 829
812 $('#patient').live('pagebeforeshow', RefreshPatient); 830 $(document).on("pagebeforeshow", "#patient", RefreshPatient);
813 $('#study').live('pagebeforeshow', RefreshStudy); 831 $(document).on("pagebeforeshow", "#study", RefreshStudy);
814 $('#series').live('pagebeforeshow', RefreshSeries); 832 $(document).on("pagebeforeshow", "#series", RefreshSeries);
815 $('#instance').live('pagebeforeshow', RefreshInstance); 833 $(document).on("pagebeforeshow", "#instance", RefreshInstance);
816 834
817 $(function() { 835 $(function() {
818 $(window).hashchange(function(e, data) { 836 $(window).hashchange(function(e, data) {
819 // This fixes the navigation with the back button and with the anonymization 837 // This fixes the navigation with the back button and with the anonymization
820 if ('uuid' in $.mobile.pageData && 838 if ('uuid' in $.mobile.pageData &&
874 }); 892 });
875 } 893 }
876 894
877 895
878 896
879 $('#instance-delete').live('click', function() { 897 $(document).on("click", "#instance-delete", function() {
880 OpenDeleteResourceDialog('../instances/' + $.mobile.pageData.uuid, 898 OpenDeleteResourceDialog('../instances/' + $.mobile.pageData.uuid,
881 'Delete this instance?'); 899 'Delete this instance?');
882 }); 900 });
883 901
884 $('#study-delete').live('click', function() { 902 $(document).on("click", "#study-delete", function(e) {
885 OpenDeleteResourceDialog('../studies/' + $.mobile.pageData.uuid, 903 OpenDeleteResourceDialog('../studies/' + $.mobile.pageData.uuid,
886 'Delete this study?'); 904 'Delete this study?');
887 }); 905 });
888 906
889 $('#series-delete').live('click', function() { 907 $(document).on("click", "#series-delete", function(e) {
890 OpenDeleteResourceDialog('../series/' + $.mobile.pageData.uuid, 908 OpenDeleteResourceDialog('../series/' + $.mobile.pageData.uuid,
891 'Delete this series?'); 909 'Delete this series?');
892 }); 910 });
893 911
894 $('#patient-delete').live('click', function() { 912 $(document).on("click", "#patient-delete", function(e) {
895 OpenDeleteResourceDialog('../patients/' + $.mobile.pageData.uuid, 913 OpenDeleteResourceDialog('../patients/' + $.mobile.pageData.uuid,
896 'Delete this patient?'); 914 'Delete this patient?');
897 }); 915 });
898 916
899 917
900 $('#instance-download-dicom').live('click', function(e) { 918 $(document).on("click", "#instance-download-dicom", function(e) {
901 // http://stackoverflow.com/a/1296101 919 // http://stackoverflow.com/a/1296101
902 e.preventDefault(); //stop the browser from following 920 e.preventDefault(); //stop the browser from following
903 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/file'; 921 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/file';
904 }); 922 });
905 923
906 $('#instance-download-json').live('click', function(e) { 924 $(document).on("click", "#instance-download-json", function(e) {
907 // http://stackoverflow.com/a/1296101 925 // http://stackoverflow.com/a/1296101
908 e.preventDefault(); //stop the browser from following 926 e.preventDefault(); //stop the browser from following
909 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/tags'; 927 window.location.href = '../instances/' + $.mobile.pageData.uuid + '/tags';
910 }); 928 });
911 929
912 930
913 931
914 $('#instance-preview').live('click', function(e) { 932 $(document).on("click", "#instance-preview", function(e) {
915 if ($.mobile.pageData) { 933 if ($.mobile.pageData) {
916 let pageData = DeepCopy($.mobile.pageData); 934 let pageData = DeepCopy($.mobile.pageData);
917 935
918 let pdf = '../instances/' + pageData.uuid + '/pdf'; 936 let pdf = '../instances/' + pageData.uuid + '/pdf';
919 $.ajax({ 937 $.ajax({
955 } 973 }
956 }); 974 });
957 975
958 976
959 977
960 $('#series-preview').live('click', function(e) { 978 $(document).on("click", "#series-preview", function(e) {
961 if ($.mobile.pageData) { 979 if ($.mobile.pageData) {
962 let pageData = DeepCopy($.mobile.pageData); 980 let pageData = DeepCopy($.mobile.pageData);
963 981
964 GetResource('/series/' + pageData.uuid, function(series) { 982 GetResource('/series/' + pageData.uuid, function(series) {
965 GetResource('/series/' + pageData.uuid + '/instances', function(instances) { 983 GetResource('/series/' + pageData.uuid + '/instances', function(instances) {
1067 } 1085 }
1068 }); 1086 });
1069 } 1087 }
1070 1088
1071 1089
1072 $('#instance-store,#series-store,#study-store,#patient-store').live('click', function(e) { 1090 $(document).on("click", "#instance-store,#series-store,#study-store,#patient-store", function(e) {
1073 ChooseDicomModality(function(modality, peer) { 1091 ChooseDicomModality(function(modality, peer) {
1074 let pageData = DeepCopy($.mobile.pageData); 1092 let pageData = DeepCopy($.mobile.pageData);
1075 1093
1076 let url; 1094 let url;
1077 let loading; 1095 let loading;
1110 } 1128 }
1111 }); 1129 });
1112 }); 1130 });
1113 1131
1114 1132
1115 $('#show-tag-name').live('change', function(e) { 1133 $(document).on("change", "#show-tag-name", function(e) {
1116 let checked = e.currentTarget.checked; 1134 let checked = e.currentTarget.checked;
1117 if (checked) 1135 if (checked)
1118 $('.tag-name').show(); 1136 $('.tag-name').show();
1119 else 1137 else
1120 $('.tag-name').hide(); 1138 $('.tag-name').hide();
1121 }); 1139 });
1122 1140
1123 1141
1124 $('#patient-archive').live('click', function(e) { 1142 $(document).on("click", "#patient-archive", function(e) {
1125 e.preventDefault(); //stop the browser from following 1143 e.preventDefault(); //stop the browser from following
1126 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/archive'; 1144 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/archive';
1127 }); 1145 });
1128 1146
1129 $('#study-archive').live('click', function(e) { 1147 $(document).on("click", "#study-archive", function(e) {
1130 e.preventDefault(); //stop the browser from following 1148 e.preventDefault(); //stop the browser from following
1131 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/archive'; 1149 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/archive';
1132 }); 1150 });
1133 1151
1134 $('#series-archive').live('click', function(e) { 1152 $(document).on("click", "#series-archive", function(e) {
1135 e.preventDefault(); //stop the browser from following 1153 e.preventDefault(); //stop the browser from following
1136 window.location.href = '../series/' + $.mobile.pageData.uuid + '/archive'; 1154 window.location.href = '../series/' + $.mobile.pageData.uuid + '/archive';
1137 }); 1155 });
1138 1156
1139 1157
1140 $('#patient-media').live('click', function(e) { 1158 $(document).on("click", "#patient-media", function(e) {
1141 e.preventDefault(); //stop the browser from following 1159 e.preventDefault(); //stop the browser from following
1142 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/media'; 1160 window.location.href = '../patients/' + $.mobile.pageData.uuid + '/media';
1143 }); 1161 });
1144 1162
1145 $('#study-media').live('click', function(e) { 1163 $(document).on("click", "#study-media", function(e) {
1146 e.preventDefault(); //stop the browser from following 1164 e.preventDefault(); //stop the browser from following
1147 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/media'; 1165 window.location.href = '../studies/' + $.mobile.pageData.uuid + '/media';
1148 }); 1166 });
1149 1167
1150 $('#series-media').live('click', function(e) { 1168 $(document).on("click", "#series-media", function(e) {
1151 e.preventDefault(); //stop the browser from following 1169 e.preventDefault(); //stop the browser from following
1152 window.location.href = '../series/' + $.mobile.pageData.uuid + '/media'; 1170 window.location.href = '../series/' + $.mobile.pageData.uuid + '/media';
1153 }); 1171 });
1154 1172
1155 1173
1156 1174
1157 $('#protection').live('change', function(e) { 1175 $(document).on("change", "#protection", function(e) {
1158 let isProtected = e.target.value == "on"; 1176 let isProtected = e.target.value == "on";
1159 $.ajax({ 1177 $.ajax({
1160 url: '../patients/' + $.mobile.pageData.uuid + '/protected', 1178 url: '../patients/' + $.mobile.pageData.uuid + '/protected',
1161 type: 'PUT', 1179 type: 'PUT',
1162 dataType: 'text', 1180 dataType: 'text',
1203 } 1221 }
1204 } 1222 }
1205 }); 1223 });
1206 } 1224 }
1207 1225
1208 $('#instance-anonymize').live('click', function() { 1226 $(document).on("click", "#instance-anonymize", function(e) {
1209 OpenAnonymizeResourceDialog('../instances/' + $.mobile.pageData.uuid, 1227 OpenAnonymizeResourceDialog('../instances/' + $.mobile.pageData.uuid,
1210 'Anonymize this instance?'); 1228 'Anonymize this instance?');
1211 }); 1229 });
1212 1230
1213 $('#study-anonymize').live('click', function() { 1231 $(document).on("click", "#study-anonymize", function(e) {
1214 OpenAnonymizeResourceDialog('../studies/' + $.mobile.pageData.uuid, 1232 OpenAnonymizeResourceDialog('../studies/' + $.mobile.pageData.uuid,
1215 'Anonymize this study?'); 1233 'Anonymize this study?');
1216 }); 1234 });
1217 1235
1218 $('#series-anonymize').live('click', function() { 1236 $(document).on("click", "#series-anonymize", function(e) {
1219 OpenAnonymizeResourceDialog('../series/' + $.mobile.pageData.uuid, 1237 OpenAnonymizeResourceDialog('../series/' + $.mobile.pageData.uuid,
1220 'Anonymize this series?'); 1238 'Anonymize this series?');
1221 }); 1239 });
1222 1240
1223 $('#patient-anonymize').live('click', function() { 1241 $(document).on("click", "#patient-anonymize", function(e) {
1224 OpenAnonymizeResourceDialog('../patients/' + $.mobile.pageData.uuid, 1242 OpenAnonymizeResourceDialog('../patients/' + $.mobile.pageData.uuid,
1225 'Anonymize this patient?'); 1243 'Anonymize this patient?');
1226 }); 1244 });
1227 1245
1228 1246
1229 $('#plugins').live('pagebeforeshow', function() { 1247 $(document).on("pagebeforeshow", "#plugins", function() {
1230 $.ajax({ 1248 $.ajax({
1231 url: '../plugins', 1249 url: '../plugins',
1232 dataType: 'json', 1250 dataType: 'json',
1233 async: false, 1251 async: false,
1234 cache: false, 1252 cache: false,
1302 .append($('<strong>').text(ParseJobTime(field)))); 1320 .append($('<strong>').text(ParseJobTime(field))));
1303 } 1321 }
1304 } 1322 }
1305 1323
1306 1324
1307 $('#jobs').live('pagebeforeshow', function() { 1325 $(document).on("pagebeforeshow", "#jobs", function() {
1308 $.ajax({ 1326 $.ajax({
1309 url: '../jobs?expand', 1327 url: '../jobs?expand',
1310 dataType: 'json', 1328 dataType: 'json',
1311 async: false, 1329 async: false,
1312 cache: false, 1330 cache: false,
1365 } 1383 }
1366 }); 1384 });
1367 }); 1385 });
1368 1386
1369 1387
1370 $('#job').live('pagebeforeshow', function() { 1388 $(document).on("pagebeforeshow", "#job", function() {
1371 if ($.mobile.pageData) { 1389 if ($.mobile.pageData) {
1372 let pageData = DeepCopy($.mobile.pageData); 1390 let pageData = DeepCopy($.mobile.pageData);
1373 1391
1374 $.ajax({ 1392 $.ajax({
1375 url: '../jobs/' + pageData.uuid, 1393 url: '../jobs/' + pageData.uuid,
1460 window.location.reload(); 1478 window.location.reload();
1461 } 1479 }
1462 }); 1480 });
1463 } 1481 }
1464 1482
1465 $('#job-cancel').live('click', function() { 1483 $(document).on("click", "#job-cancel", function(e) {
1466 TriggerJobAction('cancel'); 1484 TriggerJobAction('cancel');
1467 }); 1485 });
1468 1486
1469 $('#job-resubmit').live('click', function() { 1487 $(document).on("click", "#job-resubmit", function(e) {
1470 TriggerJobAction('resubmit'); 1488 TriggerJobAction('resubmit');
1471 }); 1489 });
1472 1490
1473 $('#job-pause').live('click', function() { 1491 $(document).on("click", "#job-pause", function(e) {
1474 TriggerJobAction('pause'); 1492 TriggerJobAction('pause');
1475 }); 1493 });
1476 1494
1477 $('#job-resume').live('click', function() { 1495 $(document).on("click", "#job-resume", function(e) {
1478 TriggerJobAction('resume'); 1496 TriggerJobAction('resume');
1479 }); 1497 });