Commit e6bfc77ee699b09cceef6ce051ba367010e089ca
1 parent
26d489cc
fix more bug and add new filesaver js
Showing
9 changed files
with
266 additions
and
57 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js
... | ... | @@ -520,23 +520,19 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
520 | 520 | |
521 | 521 | $scope.convertDownLoad = function (curriculumobject,myfileName) { |
522 | 522 | var blob = new Blob([angular.toJson(curriculumobject, true)], { type: 'text/json' }); |
523 | - | |
524 | - if (window.navigator && window.navigator.msSaveOrOpenBlob) { | |
525 | - window.navigator.msSaveOrOpenBlob(blob, myfileName); | |
526 | - } | |
527 | - else | |
528 | - { | |
529 | - document.execCommand("SaveAs", true, myfileName); | |
530 | - | |
531 | - var event = document.createEvent('MouseEvents'), | |
532 | - saveElement = document.createElement('a'); | |
533 | - saveElement.download = myfileName; | |
534 | - saveElement.href = window.URL.createObjectURL(blob); | |
535 | - saveElement.dataset.downloadurl = ['text/json', saveElement.download, saveElement.href].join(':'); | |
536 | - event.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
537 | - saveElement.dispatchEvent(event); | |
538 | - | |
539 | - } | |
523 | + | |
524 | + // document.execCommand("SaveAs", true, myfileName); | |
525 | + | |
526 | + // var event = document.createEvent('MouseEvents'), | |
527 | + // saveElement = document.createElement('a'); | |
528 | + // saveElement.download = myfileName; | |
529 | + // saveElement.href = window.URL.createObjectURL(blob); | |
530 | + // saveElement.dataset.downloadurl = ['text/json', saveElement.download, saveElement.href].join(':'); | |
531 | + // event.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
532 | + // saveElement.dispatchEvent(event); | |
533 | + | |
534 | + //save file saver handle for all browser | |
535 | + saveAs(blob, filename); | |
540 | 536 | |
541 | 537 | } |
542 | 538 | $scope.checkCompatibility = function (curriculumobject) { |
... | ... | @@ -1780,22 +1776,20 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ |
1780 | 1776 | var blob = new Blob([angular.toJson($rootScope.dynamicUpdatedJsonForSaveCB, true)], { type: 'text/json' }); |
1781 | 1777 | } |
1782 | 1778 | |
1783 | - if (window.navigator && window.navigator.msSaveOrOpenBlob) { | |
1784 | - window.navigator.msSaveOrOpenBlob(blob, filename); | |
1785 | - } | |
1786 | - else | |
1787 | - { | |
1788 | - document.execCommand("SaveAs", true, filename); | |
1779 | + // document.execCommand("SaveAs", true, filename); | |
1789 | 1780 | |
1790 | - var event = document.createEvent('MouseEvents'), | |
1791 | - saveElement = document.createElement('a'); | |
1792 | - saveElement.download = filename; | |
1793 | - saveElement.href = window.URL.createObjectURL(blob); | |
1794 | - saveElement.dataset.downloadurl = ['text/json', saveElement.download, saveElement.href].join(':'); | |
1795 | - event.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
1796 | - saveElement.dispatchEvent(event); | |
1781 | + // var event = document.createEvent('MouseEvents'), | |
1782 | + // saveElement = document.createElement('a'); | |
1783 | + // saveElement.download = filename; | |
1784 | + // saveElement.href = window.URL.createObjectURL(blob); | |
1785 | + // saveElement.dataset.downloadurl = ['text/json', saveElement.download, saveElement.href].join(':'); | |
1786 | + // event.initEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
1787 | + // saveElement.dispatchEvent(event); | |
1788 | + | |
1789 | + //save file saver handle for all browser | |
1790 | + saveAs(blob, filename); | |
1797 | 1791 | |
1798 | - } | |
1792 | + // } | |
1799 | 1793 | $scope.SectionContentForExportCB=[]; |
1800 | 1794 | $rootScope.dynamicUpdatedJsonForExportCB = ""; |
1801 | 1795 | $rootScope.dynamicUpdatedJsonForSaveCB = ""; | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -5878,6 +5878,10 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l |
5878 | 5878 | // var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; |
5879 | 5879 | var touch = e.touches[0] || e.changedTouches[0]; |
5880 | 5880 | var currentMousePosition = $scope.getMousePos(touch.pageX,touch.pageY,windowviewid); |
5881 | + } | |
5882 | + else | |
5883 | + { | |
5884 | + var currentMousePosition = $scope.getMousePos(e.pageX,e.pageY,windowviewid); | |
5881 | 5885 | } |
5882 | 5886 | } |
5883 | 5887 | else |
... | ... | @@ -5951,6 +5955,10 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l |
5951 | 5955 | var touch = e.touches[0] || e.changedTouches[0]; |
5952 | 5956 | var currentMousePosition = $scope.getMousePos(touch.pageX,touch.pageY,windowviewid); |
5953 | 5957 | } |
5958 | + else | |
5959 | + { | |
5960 | + var currentMousePosition = $scope.getMousePos(e.pageX,e.pageY,windowviewid); | |
5961 | + } | |
5954 | 5962 | } |
5955 | 5963 | else |
5956 | 5964 | { |
... | ... | @@ -6013,7 +6021,11 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l |
6013 | 6021 | // var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; |
6014 | 6022 | var touch = e.touches[0] || e.changedTouches[0]; |
6015 | 6023 | var currentMousePosition = $scope.getMousePos(touch.pageX,touch.pageY,windowviewid); |
6016 | - } | |
6024 | + } | |
6025 | + else | |
6026 | + { | |
6027 | + var currentMousePosition = $scope.getMousePos(e.pageX,e.pageY,windowviewid); | |
6028 | + } | |
6017 | 6029 | } |
6018 | 6030 | else |
6019 | 6031 | { |
... | ... | @@ -11379,11 +11391,10 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l |
11379 | 11391 | |
11380 | 11392 | $('#searchedTermListPopUp_' + windowviewid).draggable({containment:'#daViewDA_' + windowviewid}); |
11381 | 11393 | |
11382 | - setTimeout(() => { | |
11394 | + setTimeout(function () { | |
11383 | 11395 | $scope.FillSearchList(windowviewid); |
11384 | 11396 | }, 100); |
11385 | - | |
11386 | - | |
11397 | + | |
11387 | 11398 | } |
11388 | 11399 | $scope.FillSearchList = function (windowviewid) { |
11389 | 11400 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -6068,9 +6068,19 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
6068 | 6068 | } |
6069 | 6069 | |
6070 | 6070 | function longest_string(str_ara) { |
6071 | - let max = str_ara[0].length; | |
6072 | - str_ara.map(v => max = Math.max(max, v.length)); | |
6073 | - var result = str_ara.filter(v => v.length == max); | |
6071 | + var max = str_ara[0].length; | |
6072 | + | |
6073 | + str_ara.map(function(v){ | |
6074 | + max = Math.max(max, v.length); | |
6075 | + }); | |
6076 | + | |
6077 | + var result = str_ara.filter(function (v) { | |
6078 | + return v.length == max; | |
6079 | + }); | |
6080 | + | |
6081 | + //expression not working on ie 11 | |
6082 | + // str_ara.map(v => max = Math.max(max, v.length)); | |
6083 | + //var result = str_ara.filter(v => v.length == max); | |
6074 | 6084 | return result; |
6075 | 6085 | } |
6076 | 6086 | |
... | ... | @@ -6170,8 +6180,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
6170 | 6180 | |
6171 | 6181 | var storeLine = ''; |
6172 | 6182 | //---- |
6173 | - let isDrawing = false; | |
6174 | - let currentCanvasId = ''; | |
6183 | + var isDrawing = false; | |
6184 | + var currentCanvasId = ''; | |
6175 | 6185 | $scope.onDrawingCanvasOnModule = function (annotationCanvas) { |
6176 | 6186 | |
6177 | 6187 | //remove old event listener |
... | ... | @@ -6239,17 +6249,20 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
6239 | 6249 | if(event.type == 'touchstart' || event.type == 'touchmove' || event.type == 'touchend' || event.type == 'touchcancel'){ |
6240 | 6250 | // var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; |
6241 | 6251 | var touch = event.touches[0] || event.changedTouches[0]; |
6242 | - var verticalScrollPosition = canvasDiv.scrollTop; | |
6243 | - var horizontlScrollPosition = canvasDiv.scrollLeft; | |
6244 | 6252 | $rootScope.offsetX1 = touch.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left; |
6245 | 6253 | $rootScope.offsetY1 = touch.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top; |
6246 | 6254 | } |
6255 | + else | |
6256 | + { | |
6257 | + $rootScope.offsetX1 = event.offsetX ; | |
6258 | + $rootScope.offsetY1 = event.offsetY ; | |
6259 | + } | |
6247 | 6260 | |
6248 | 6261 | } |
6249 | 6262 | else |
6250 | 6263 | { |
6251 | - $rootScope.offsetX1 = event.offsetX; | |
6252 | - $rootScope.offsetY1 = event.offsetY; | |
6264 | + $rootScope.offsetX1 = event.offsetX ; | |
6265 | + $rootScope.offsetY1 = event.offsetY ; | |
6253 | 6266 | } |
6254 | 6267 | // ctx.clearRect(0, 0, 2277, 3248); |
6255 | 6268 | |
... | ... | @@ -6312,7 +6325,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
6312 | 6325 | var touch = event.touches[0] || event.changedTouches[0]; |
6313 | 6326 | $rootScope.x = touch.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left; |
6314 | 6327 | $rootScope.y = touch.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top; |
6315 | - } | |
6328 | + } | |
6329 | + else | |
6330 | + { | |
6331 | + $rootScope.x =Math.round(event.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left); | |
6332 | + $rootScope.y =Math.round(event.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top); | |
6333 | + } | |
6316 | 6334 | } |
6317 | 6335 | else |
6318 | 6336 | { |
... | ... | @@ -6441,7 +6459,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
6441 | 6459 | var touch = event.touches[0] || event.changedTouches[0]; |
6442 | 6460 | $rootScope.MouseMoveXAxis = touch.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left; |
6443 | 6461 | $rootScope.MouseMoveYAxis = touch.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top; |
6444 | - } | |
6462 | + } | |
6463 | + else | |
6464 | + { | |
6465 | + $rootScope.MouseMoveXAxis = event.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left; | |
6466 | + $rootScope.MouseMoveYAxis = event.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top; | |
6467 | + } | |
6445 | 6468 | |
6446 | 6469 | } |
6447 | 6470 | else | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/widget/MainMenu.html
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | <div class="col-sm-12 col-md-12 pageHeading"> |
4 | 4 | <!--<button type="button" class="btn btn-success pull-left toggleBar btn-sm" data-toggle="tooltip" data-placement="top" title="Show/Hide Sidebar"> <i class="fa fa-bars"></i> </button>--> |
5 | 5 | <div class=" pull-left toggleBar toggleHeadingButton tooltip-sidebar" data-toggle="tooltip" data-placement="top" title="Show/Hide Sidebar"> <i class="fa fa-bars"></i> </div> |
6 | - <h4 class="pull-left" data-ng-bind="currentActiveModuleTitle"><!--{{currentActiveModuleTitle}}--></h4> | |
6 | + <h4 class="pull-left" data-ng-bind="currentActiveModuleTitle" style="white-space: nowrap;"></h4> | |
7 | 7 | <div class="pull-right paddTop4 "> |
8 | 8 | <!--<div class="pull-right paddTop4 ">--> |
9 | 9 | <div role="group" ng-show="showTabButton" class="btn-group"> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/body-view-wp.js
... | ... | @@ -18,7 +18,7 @@ loadBodyViewData = function (currentBodyViewId) |
18 | 18 | { |
19 | 19 | bodyRegionData = JSON.parse(req.responseText); |
20 | 20 | |
21 | - console.log("bodyRegionData returned: " + bodyRegionData); | |
21 | + // console.log("bodyRegionData returned: " + bodyRegionData); | |
22 | 22 | |
23 | 23 | loadLayerDataForCurrentBodyView(currentBodyViewId) |
24 | 24 | } |
... | ... | @@ -45,7 +45,7 @@ loadLayerDataForCurrentBodyView = function (currentBodyViewId) { |
45 | 45 | if (req.readyState == 4 && req.status == 200) { |
46 | 46 | bodyLayerData = JSON.parse(req.responseText); |
47 | 47 | |
48 | - console.log("data returned: " + bodyLayerData); | |
48 | + // console.log("data returned: " + bodyLayerData); | |
49 | 49 | |
50 | 50 | loadBodyArtData(); |
51 | 51 | } |
... | ... | @@ -68,7 +68,7 @@ loadBodyArtData = function () { |
68 | 68 | req.onreadystatechange = function () { |
69 | 69 | if (req.readyState == 4 && req.status == 200) { |
70 | 70 | bodyArtData = JSON.parse(req.responseText); |
71 | - console.log("data returned: " + bodyArtData); | |
71 | + // console.log("data returned: " + bodyArtData); | |
72 | 72 | |
73 | 73 | self.postMessage({ |
74 | 74 | 'bodyRegionData': bodyRegionData, | ... | ... |
400-SOURCECODE/AIAHTML5.Web/extract-wp.js
1 | 1 | ๏ปฟpreviousGrayImageDataList = []; |
2 | 2 | getLocationForMatchedTermsInWholeBody = function (termList, maskCanvasData, coloredImageData, grayImageData, bodyRegionId, canvasId) { |
3 | - console.log('for bodyRegionId: ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")) | |
3 | + // console.log('for bodyRegionId: ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")) | |
4 | 4 | |
5 | 5 | var masklen = maskCanvasData.data.length; |
6 | 6 | var maskData = maskCanvasData.data; | ... | ... |
400-SOURCECODE/AIAHTML5.Web/index.aspx
... | ... | @@ -1585,7 +1585,6 @@ |
1585 | 1585 | |
1586 | 1586 | |
1587 | 1587 | <!--<script src="libs/jquery/1.11.3/jquery.min.js"></script>--> |
1588 | - <script src="libs/tinymce/tinymce.min.js"></script> | |
1589 | 1588 | <script src="libs/jquery/2.1.3/jquery.min.js"></script> |
1590 | 1589 | <script src="libs/jquery/1.11.4/jquery-ui.js"></script> |
1591 | 1590 | <script src="libs/xml2json.js"></script> |
... | ... | @@ -1652,11 +1651,13 @@ |
1652 | 1651 | <!--<script src="libs/color-picker/jquery.minicolors.min.js"></script>--> |
1653 | 1652 | |
1654 | 1653 | <script src="libs/sketch.js"></script> |
1654 | + <script src="libs/tinymce/tinymce.min.js"></script> | |
1655 | + <script src="libs/tinymce/jquery.tinymce.min.js"></script> | |
1655 | 1656 | <!-- <script src="libs/tinymce/tinymce.min.js"></script> --> |
1656 | 1657 | <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>--> |
1657 | 1658 | <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script> |
1658 | 1659 | <script src="libs/html2canvas.js?v=1.0.0"></script> |
1659 | - <script src="libs/FileSaver.js"></script> | |
1660 | + <script src="libs/FileSaverNew.js"></script> | |
1660 | 1661 | <script src="app/services/LabExerciseService.js?v=1.0.0"></script> |
1661 | 1662 | |
1662 | 1663 | <script> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/libs/FileSaverNew.js
0 โ 100644
1 | +(function (global, factory) { | |
2 | + if (typeof define === "function" && define.amd) { | |
3 | + define([], factory); | |
4 | + } else if (typeof exports !== "undefined") { | |
5 | + factory(); | |
6 | + } else { | |
7 | + var mod = { | |
8 | + exports: {} | |
9 | + }; | |
10 | + factory(); | |
11 | + global.FileSaver = mod.exports; | |
12 | + } | |
13 | +})(this, function () { | |
14 | + "use strict"; | |
15 | + | |
16 | + /* | |
17 | + * FileSaver.js | |
18 | + * A saveAs() FileSaver implementation. | |
19 | + * | |
20 | + * By Eli Grey, http://eligrey.com | |
21 | + * | |
22 | + * License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT) | |
23 | + * source : http://purl.eligrey.com/github/FileSaver.js | |
24 | + */ | |
25 | + // The one and only way of getting global scope in all environments | |
26 | + // https://stackoverflow.com/q/3277182/1008999 | |
27 | + var _global = typeof window === 'object' && window.window === window ? window : typeof self === 'object' && self.self === self ? self : typeof global === 'object' && global.global === global ? global : void 0; | |
28 | + | |
29 | + function bom(blob, opts) { | |
30 | + if (typeof opts === 'undefined') opts = { | |
31 | + autoBom: false | |
32 | + };else if (typeof opts !== 'object') { | |
33 | + console.warn('Depricated: Expected third argument to be a object'); | |
34 | + opts = { | |
35 | + autoBom: !opts | |
36 | + }; | |
37 | + } // prepend BOM for UTF-8 XML and text/* types (including HTML) | |
38 | + // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF | |
39 | + | |
40 | + if (opts.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) { | |
41 | + return new Blob([String.fromCharCode(0xFEFF), blob], { | |
42 | + type: blob.type | |
43 | + }); | |
44 | + } | |
45 | + | |
46 | + return blob; | |
47 | + } | |
48 | + | |
49 | + function download(url, name, opts) { | |
50 | + var xhr = new XMLHttpRequest(); | |
51 | + xhr.open('GET', url); | |
52 | + xhr.responseType = 'blob'; | |
53 | + | |
54 | + xhr.onload = function () { | |
55 | + saveAs(xhr.response, name, opts); | |
56 | + }; | |
57 | + | |
58 | + xhr.onerror = function () { | |
59 | + console.error('could not download file'); | |
60 | + }; | |
61 | + | |
62 | + xhr.send(); | |
63 | + } | |
64 | + | |
65 | + function corsEnabled(url) { | |
66 | + var xhr = new XMLHttpRequest(); // use sync to avoid popup blocker | |
67 | + | |
68 | + xhr.open('HEAD', url, false); | |
69 | + xhr.send(); | |
70 | + return xhr.status >= 200 && xhr.status <= 299; | |
71 | + } // `a.click()` doesn't work for all browsers (#465) | |
72 | + | |
73 | + | |
74 | + function click(node) { | |
75 | + try { | |
76 | + node.dispatchEvent(new MouseEvent('click')); | |
77 | + } catch (e) { | |
78 | + var evt = document.createEvent('MouseEvents'); | |
79 | + evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null); | |
80 | + node.dispatchEvent(evt); | |
81 | + } | |
82 | + } | |
83 | + | |
84 | + var saveAs = _global.saveAs || // probably in some web worker | |
85 | + typeof window !== 'object' || window !== _global ? function saveAs() {} | |
86 | + /* noop */ | |
87 | + // Use download attribute first if possible (#193 Lumia mobile) | |
88 | + : 'download' in HTMLAnchorElement.prototype ? function saveAs(blob, name, opts) { | |
89 | + var URL = _global.URL || _global.webkitURL; | |
90 | + var a = document.createElement('a'); | |
91 | + name = name || blob.name || 'download'; | |
92 | + a.download = name; | |
93 | + a.rel = 'noopener'; // tabnabbing | |
94 | + // TODO: detect chrome extensions & packaged apps | |
95 | + // a.target = '_blank' | |
96 | + | |
97 | + if (typeof blob === 'string') { | |
98 | + // Support regular links | |
99 | + a.href = blob; | |
100 | + | |
101 | + if (a.origin !== location.origin) { | |
102 | + corsEnabled(a.href) ? download(blob, name, opts) : click(a, a.target = '_blank'); | |
103 | + } else { | |
104 | + click(a); | |
105 | + } | |
106 | + } else { | |
107 | + // Support blobs | |
108 | + a.href = URL.createObjectURL(blob); | |
109 | + setTimeout(function () { | |
110 | + URL.revokeObjectURL(a.href); | |
111 | + }, 4E4); // 40s | |
112 | + | |
113 | + setTimeout(function () { | |
114 | + click(a); | |
115 | + }, 0); | |
116 | + } | |
117 | + } // Use msSaveOrOpenBlob as a second approach | |
118 | + : 'msSaveOrOpenBlob' in navigator ? function saveAs(blob, name, opts) { | |
119 | + name = name || blob.name || 'download'; | |
120 | + | |
121 | + if (typeof blob === 'string') { | |
122 | + if (corsEnabled(blob)) { | |
123 | + download(blob, name, opts); | |
124 | + } else { | |
125 | + var a = document.createElement('a'); | |
126 | + a.href = blob; | |
127 | + a.target = '_blank'; | |
128 | + setTimeout(function () { | |
129 | + click(a); | |
130 | + }); | |
131 | + } | |
132 | + } else { | |
133 | + navigator.msSaveOrOpenBlob(bom(blob, opts), name); | |
134 | + } | |
135 | + } // Fallback to using FileReader and a popup | |
136 | + : function saveAs(blob, name, opts, popup) { | |
137 | + // Open a popup immediately do go around popup blocker | |
138 | + // Mostly only avalible on user interaction and the fileReader is async so... | |
139 | + popup = popup || open('', '_blank'); | |
140 | + | |
141 | + if (popup) { | |
142 | + popup.document.title = popup.document.body.innerText = 'downloading...'; | |
143 | + } | |
144 | + | |
145 | + if (typeof blob === 'string') return download(blob, name, opts); | |
146 | + var force = blob.type === 'application/octet-stream'; | |
147 | + | |
148 | + var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari; | |
149 | + | |
150 | + var isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent); | |
151 | + | |
152 | + if ((isChromeIOS || force && isSafari) && typeof FileReader === 'object') { | |
153 | + // Safari doesn't allow downloading of blob urls | |
154 | + var reader = new FileReader(); | |
155 | + | |
156 | + reader.onloadend = function () { | |
157 | + var url = reader.result; | |
158 | + url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;'); | |
159 | + if (popup) popup.location.href = url;else location = url; | |
160 | + popup = null; // reverse-tabnabbing #460 | |
161 | + }; | |
162 | + | |
163 | + reader.readAsDataURL(blob); | |
164 | + } else { | |
165 | + var URL = _global.URL || _global.webkitURL; | |
166 | + var url = URL.createObjectURL(blob); | |
167 | + if (popup) popup.location = url;else location.href = url; | |
168 | + popup = null; // reverse-tabnabbing #460 | |
169 | + | |
170 | + setTimeout(function () { | |
171 | + URL.revokeObjectURL(url); | |
172 | + }, 4E4); // 40s | |
173 | + } | |
174 | + }; | |
175 | + _global.saveAs = saveAs.saveAs = saveAs; | |
176 | + | |
177 | + if (typeof module !== 'undefined') { | |
178 | + module.exports = saveAs; | |
179 | + } | |
180 | +}); | |
0 | 181 | \ No newline at end of file | ... | ... |
400-SOURCECODE/AIAHTML5.Web/search-wp.js
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | |
3 | 3 | loadTermData = function (currentBodyViewId, languageName, languageID) { |
4 | 4 | |
5 | - console.log('search-wp, loadTermData, time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); | |
5 | + // console.log('search-wp, loadTermData, time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); | |
6 | 6 | var termNoJsonPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_tm_sg_' + currentBodyViewId + '.json'; |
7 | 7 | |
8 | 8 | var TermNumberData; |
... | ... | @@ -13,7 +13,7 @@ loadTermData = function (currentBodyViewId, languageName, languageID) { |
13 | 13 | AJAX_req.onreadystatechange = function () { |
14 | 14 | if (AJAX_req.readyState == 4 && AJAX_req.status == 200) { |
15 | 15 | TermNumberData = JSON.parse(AJAX_req.responseText); |
16 | - console.log("data returned: " + TermNumberData); | |
16 | + // console.log("data returned: " + TermNumberData); | |
17 | 17 | |
18 | 18 | loadTermTextData(TermNumberData, languageName, languageID, currentBodyViewId); |
19 | 19 | |
... | ... | @@ -52,7 +52,7 @@ loadTermTextData = function (TermNumberData, languageName, languageID, currentBo |
52 | 52 | AJAX_req.setRequestHeader("Content-type", "application/json"); |
53 | 53 | AJAX_req.onreadystatechange = function () { |
54 | 54 | if (AJAX_req.readyState == 4 && AJAX_req.status == 200) { |
55 | - console.log('AJAX_req.readyState= ' + AJAX_req.readyState + ' and AJAX_req.status =' + AJAX_req.status); | |
55 | + //console.log('AJAX_req.readyState= ' + AJAX_req.readyState + ' and AJAX_req.status =' + AJAX_req.status); | |
56 | 56 | |
57 | 57 | VocabTermData = JSON.parse(AJAX_req.responseText); |
58 | 58 | var vocabTermTxt = []; |
... | ... | @@ -84,7 +84,7 @@ loadTermTextData = function (TermNumberData, languageName, languageID, currentBo |
84 | 84 | |
85 | 85 | |
86 | 86 | self.onmessage = function (e) { |
87 | - console.log("search"); | |
87 | + // console.log("search"); | |
88 | 88 | loadTermData(e.data.currentBodyViewId, e.data.languageName, e.data.languageID); |
89 | 89 | |
90 | 90 | ... | ... |