|
17 | 17 | * limitations under the License.
|
18 | 18 | * =========================LICENSE_END==================================
|
19 | 19 | */
|
20 |
| -(function(window, $, Coral) { |
| 20 | +(function (window, $, Coral) { |
21 | 21 | 'use strict';
|
22 | 22 |
|
23 | 23 | let dragCounter = 0,
|
24 |
| - fileUploader; |
| 24 | + fileUploader ; |
25 | 25 |
|
26 | 26 | function init() {
|
27 | 27 | fileUploader = new Coral.FileUpload();
|
|
42 | 42 | ];
|
43 | 43 | fileUploader.upload(filename);
|
44 | 44 | })
|
45 |
| - .on('coral-fileupload:load', function(event) { |
| 45 | + .on('coral-fileupload:load', function (event) { |
46 | 46 | let savePath = window.location.pathname.split('.html')[1];
|
47 |
| - fileUploader.uploadQueue.forEach(function(item, index) { |
| 47 | + fileUploader.uploadQueue.forEach(function (item, index) { |
48 | 48 | let filename = event.detail.item.file.name;
|
49 | 49 | if (item.file.name === filename) {
|
50 | 50 | item._parameters = [
|
|
57 | 57 | _reload();
|
58 | 58 | }
|
59 | 59 | });
|
| 60 | + fileUploader._getTargetChangeInput().addEventListener('change', function (event) { |
| 61 | + fileUploader._onInputChange(event); |
| 62 | + }); |
60 | 63 |
|
61 | 64 | const coralShell = $('coral-shell-content').get(0);
|
62 |
| - coralShell.addEventListener('drop', function(event) { |
| 65 | + coralShell.addEventListener('drop', function (event) { |
63 | 66 | dragCounter = 0;
|
64 | 67 | event.preventDefault();
|
65 | 68 | _dropZoneDrop();
|
66 | 69 | fileUploader._onInputChange(event);
|
67 | 70 | }, false);
|
68 |
| - coralShell.addEventListener('dragenter', function(event) { |
| 71 | + coralShell.addEventListener('dragenter', function (event) { |
69 | 72 | event.preventDefault();
|
70 | 73 | dragCounter++;
|
71 | 74 | _dropZoneDragEnter();
|
72 | 75 | }, false);
|
73 |
| - coralShell.addEventListener('dragover', function(event) { |
| 76 | + coralShell.addEventListener('dragover', function (event) { |
74 | 77 | event.preventDefault();
|
75 | 78 | }, false);
|
76 |
| - coralShell.addEventListener('dragleave', function() { |
| 79 | + coralShell.addEventListener('dragleave', function () { |
77 | 80 | dragCounter--;
|
78 | 81 | if (dragCounter === 0) {
|
79 | 82 | _dropZoneDragLeave();
|
|
87 | 90 |
|
88 | 91 | function _dropZoneDragEnter() {
|
89 | 92 | let message = Granite.I18n.get('Drag and drop to upload'),
|
90 |
| - dragAndDropMessage = $('<div class=\"drag-drop-message\" style="text-align: center;"><h1 > <span>{</span>' + message + '<span>}</span></h1></div>'); |
| 93 | + dragAndDropMessage = $('<div class=\"drag-drop-message\" style="text-align: center;"><h1 > <span>{</span>' + message + '<span>}</span></h1></div>'); |
91 | 94 | $('.foundation-collection').overlayMask('show', dragAndDropMessage);
|
92 | 95 | }
|
93 | 96 |
|
94 | 97 | function _dropZoneDragLeave() {
|
95 | 98 | $('.foundation-collection').overlayMask('hide');
|
96 | 99 | }
|
97 | 100 |
|
98 |
| - function _dropZoneDrop () { |
| 101 | + function _dropZoneDrop() { |
99 | 102 | $('.foundation-collection').overlayMask('hide');
|
100 | 103 | }
|
101 | 104 |
|
102 | 105 | $(window).adaptTo('foundation-registry').register('foundation.collection.action.action', {
|
103 | 106 | name: 'scripts.upload',
|
104 |
| - handler: function() { |
| 107 | + handler: function () { |
105 | 108 | fileUploader._showFileDialog();
|
106 | 109 | }
|
107 | 110 | });
|
|
0 commit comments