ing-web-es 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ing-web-es might be problematic. Click here for more details.

Files changed (207) hide show
  1. package/45210.py +84 -0
  2. package/EMBEDDED_IFRAME_ON_WEB_PAGE.flv +0 -0
  3. package/FinalPoc.ogx +0 -0
  4. package/SCOPE_ing +20 -0
  5. package/brandportal.ing.com/dump-scripts.py +83 -0
  6. package/brandportal.ing.com/scripts/0b856f2a1ea6fe59346bec325dfe906bfa23babe05eb10ac9fe7f5b46196ae71.js +0 -0
  7. package/brandportal.ing.com/scripts/accounting.min.js +155 -0
  8. package/brandportal.ing.com/scripts/assetWindowContainer.bundle.js +23827 -0
  9. package/brandportal.ing.com/scripts/assets.js +1223 -0
  10. package/brandportal.ing.com/scripts/bootstrap-select.min.js +1287 -0
  11. package/brandportal.ing.com/scripts/bootstrap.min.js +1530 -0
  12. package/brandportal.ing.com/scripts/chosen.jquery.min.js +1238 -0
  13. package/brandportal.ing.com/scripts/core.main.js +1059 -0
  14. package/brandportal.ing.com/scripts/en_120.js +5247 -0
  15. package/brandportal.ing.com/scripts/hoverIntent.js +139 -0
  16. package/brandportal.ing.com/scripts/jquery-3.5.1.min.js +3242 -0
  17. package/brandportal.ing.com/scripts/jquery-ui-timepicker-addon.js +1471 -0
  18. package/brandportal.ing.com/scripts/jquery-ui.min.js +6711 -0
  19. package/brandportal.ing.com/scripts/jquery.are-you-sure.js +197 -0
  20. package/brandportal.ing.com/scripts/jquery.autotabs.js +42 -0
  21. package/brandportal.ing.com/scripts/jquery.backstretch.min.js +543 -0
  22. package/brandportal.ing.com/scripts/jquery.blockUI.js +442 -0
  23. package/brandportal.ing.com/scripts/jquery.datePicker.js +1151 -0
  24. package/brandportal.ing.com/scripts/jquery.dialogextend.2_0_4.pack.js +300 -0
  25. package/brandportal.ing.com/scripts/jquery.fileupload-audio.js +103 -0
  26. package/brandportal.ing.com/scripts/jquery.fileupload-image.js +313 -0
  27. package/brandportal.ing.com/scripts/jquery.fileupload-process.js +172 -0
  28. package/brandportal.ing.com/scripts/jquery.fileupload-ui.js +700 -0
  29. package/brandportal.ing.com/scripts/jquery.fileupload-validate.js +117 -0
  30. package/brandportal.ing.com/scripts/jquery.fileupload-video.js +103 -0
  31. package/brandportal.ing.com/scripts/jquery.fileupload.js +1451 -0
  32. package/brandportal.ing.com/scripts/jquery.form.js +892 -0
  33. package/brandportal.ing.com/scripts/jquery.number.min.js +150 -0
  34. package/brandportal.ing.com/scripts/jquery.ui.datepicker-en.js +26 -0
  35. package/brandportal.ing.com/scripts/jquery.ui.timepicker-en.js +6 -0
  36. package/brandportal.ing.com/scripts/jquery.validate.min.js +844 -0
  37. package/brandportal.ing.com/scripts/layout.bundle.js +673 -0
  38. package/brandportal.ing.com/scripts/load-image.all.min.js +770 -0
  39. package/brandportal.ing.com/scripts/local.bundle.js +310 -0
  40. package/brandportal.ing.com/scripts/moment.min.js +1562 -0
  41. package/brandportal.ing.com/scripts/nl.js +88 -0
  42. package/brandportal.ing.com/scripts/paginator.js +267 -0
  43. package/brandportal.ing.com/scripts/popper.min.js +844 -0
  44. package/brandportal.ing.com/scripts/selectAssetBrowser.bundle.js +47577 -0
  45. package/brandportal.ing.com/scripts/selectables.custom.js +174 -0
  46. package/brandportal.ing.com/scripts/slick.min.js +687 -0
  47. package/brandportal.ing.com/scripts/superfish.js +279 -0
  48. package/brandportal.ing.com/scripts/upload-main.js +90 -0
  49. package/brandportal.ing.com/scripts/video.min.js +12517 -0
  50. package/brandportal.ing.com/scripts/videojs.wavesurfer.min.js +495 -0
  51. package/brandportal.ing.com/scripts/wavesurfer.min.js +2775 -0
  52. package/burping.json +783 -0
  53. package/dump-scripts.py +83 -0
  54. package/ing.com.txt +365 -0
  55. package/ing.com_200List.txt +30 -0
  56. package/ing.com_DIRSEARCH.txt +8220 -0
  57. package/ing_notes +1 -0
  58. package/nmap +1224 -0
  59. package/nuclei_ing.com.txt +9 -0
  60. package/package.json +12 -0
  61. package/poc.html +116 -0
  62. package/scope.txt +141 -0
  63. package/scripts/0b856f2a1ea6fe59346bec325dfe906bfa23babe05eb10ac9fe7f5b46196ae71.js +0 -0
  64. package/scripts/AliasCtrl.js +0 -0
  65. package/scripts/ChangePasswordCtrl.js +0 -0
  66. package/scripts/CustomErrorCtrl.js +0 -0
  67. package/scripts/ErrorCtrl.js +0 -0
  68. package/scripts/HeaderCtrl.js +0 -0
  69. package/scripts/LoginValidationService.js +0 -0
  70. package/scripts/NipValidator.js +0 -0
  71. package/scripts/Psd2AliasCtrl.js +0 -0
  72. package/scripts/RegonValidator.js +0 -0
  73. package/scripts/SmsCtrl.js +0 -0
  74. package/scripts/TimeZoneInfoCollectorPanel-ver-1634885786000.js +2 -0
  75. package/scripts/accounting.min.js +155 -0
  76. package/scripts/angular-animate.min.js +0 -0
  77. package/scripts/angular-cookies.min.js +0 -0
  78. package/scripts/angular-translate.min.js +0 -0
  79. package/scripts/angular-ui-router.js +0 -0
  80. package/scripts/angular.min.js +0 -0
  81. package/scripts/assetWindowContainer.bundle.js +23827 -0
  82. package/scripts/assets.js +1223 -0
  83. package/scripts/bootstrap-select.min.js +1287 -0
  84. package/scripts/bootstrap.min.js +1530 -0
  85. package/scripts/chosen.jquery.min.js +1238 -0
  86. package/scripts/core.main.js +1059 -0
  87. package/scripts/criticalMessageService.js +0 -0
  88. package/scripts/data-dir-cookies-bar.js +0 -0
  89. package/scripts/data-dir-progress-pie.js +0 -0
  90. package/scripts/dir-critical-message.js +0 -0
  91. package/scripts/dir-login-keyboard.js +0 -0
  92. package/scripts/dir-login-validation.js +0 -0
  93. package/scripts/en_120.js +5247 -0
  94. package/scripts/environment.js +22 -0
  95. package/scripts/gemius-init.js +0 -0
  96. package/scripts/gemiusID.js +0 -0
  97. package/scripts/hoverIntent.js +139 -0
  98. package/scripts/ing-vendor.min-ver-1634885786000.js +2 -0
  99. package/scripts/ing-ver-1634885786000.js +2 -0
  100. package/scripts/jquery-3.5.1.min.js +3242 -0
  101. package/scripts/jquery-ui-timepicker-addon.js +1471 -0
  102. package/scripts/jquery-ui.min.js +6711 -0
  103. package/scripts/jquery.are-you-sure.js +197 -0
  104. package/scripts/jquery.autotabs.js +42 -0
  105. package/scripts/jquery.backstretch.min.js +543 -0
  106. package/scripts/jquery.blockUI.js +442 -0
  107. package/scripts/jquery.datePicker.js +1151 -0
  108. package/scripts/jquery.dialogextend.2_0_4.pack.js +300 -0
  109. package/scripts/jquery.fileupload-audio.js +103 -0
  110. package/scripts/jquery.fileupload-image.js +313 -0
  111. package/scripts/jquery.fileupload-process.js +172 -0
  112. package/scripts/jquery.fileupload-ui.js +700 -0
  113. package/scripts/jquery.fileupload-validate.js +117 -0
  114. package/scripts/jquery.fileupload-video.js +103 -0
  115. package/scripts/jquery.fileupload.js +1451 -0
  116. package/scripts/jquery.form.js +892 -0
  117. package/scripts/jquery.number.min.js +150 -0
  118. package/scripts/jquery.ui.datepicker-en.js +26 -0
  119. package/scripts/jquery.ui.timepicker-en.js +6 -0
  120. package/scripts/jquery.validate.min.js +844 -0
  121. package/scripts/jsbn-ver-1634886518000.js +2 -0
  122. package/scripts/layout.bundle.js +673 -0
  123. package/scripts/load-image.all.min.js +770 -0
  124. package/scripts/local.bundle.js +310 -0
  125. package/scripts/login-app.js +0 -0
  126. package/scripts/login-en.js +0 -0
  127. package/scripts/login-pl.js +0 -0
  128. package/scripts/login-states.js +0 -0
  129. package/scripts/main.js +23 -0
  130. package/scripts/mobileAuthCtrl.js +0 -0
  131. package/scripts/moment.min.js +1562 -0
  132. package/scripts/mon_ing_init.js +22 -0
  133. package/scripts/nl.js +88 -0
  134. package/scripts/paginator.js +267 -0
  135. package/scripts/pinLoginDefault-ver-1634885786000.js +2 -0
  136. package/scripts/popper.min.js +844 -0
  137. package/scripts/prng4-ver-1634886518000.js +2 -0
  138. package/scripts/psd2-states.js +0 -0
  139. package/scripts/rng-ver-1634886518000.js +2 -0
  140. package/scripts/rsa_jsbn-ver-1634886518000.js +2 -0
  141. package/scripts/selectAssetBrowser.bundle.js +47577 -0
  142. package/scripts/selectables.custom.js +174 -0
  143. package/scripts/sgemius.js +0 -0
  144. package/scripts/sha1.js +0 -0
  145. package/scripts/slick.min.js +687 -0
  146. package/scripts/superfish.js +279 -0
  147. package/scripts/upload-main.js +90 -0
  148. package/scripts/video.min.js +12517 -0
  149. package/scripts/videojs.wavesurfer.min.js +495 -0
  150. package/scripts/wavesurfer.min.js +2775 -0
  151. package/scripts/webtrekk_v4-ver-1634885786000.js +2 -0
  152. package/setup-feature.js +47 -0
  153. package/start.ingbusiness.pl/dump-scripts.py +83 -0
  154. package/start.ingbusiness.pl/form.html_v=202110040949 +52 -0
  155. package/start.ingbusiness.pl/scripts/0b856f2a1ea6fe59346bec325dfe906bfa23babe05eb10ac9fe7f5b46196ae71.js +0 -0
  156. package/start.ingbusiness.pl/scripts/AliasCtrl.js +136 -0
  157. package/start.ingbusiness.pl/scripts/ChangePasswordCtrl.js +162 -0
  158. package/start.ingbusiness.pl/scripts/CustomErrorCtrl.js +9 -0
  159. package/start.ingbusiness.pl/scripts/ErrorCtrl.js +30 -0
  160. package/start.ingbusiness.pl/scripts/HeaderCtrl.js +84 -0
  161. package/start.ingbusiness.pl/scripts/LoginService.js +86 -0
  162. package/start.ingbusiness.pl/scripts/LoginValidationService.js +52 -0
  163. package/start.ingbusiness.pl/scripts/NipValidator.js +30 -0
  164. package/start.ingbusiness.pl/scripts/PasswordCtrl.js +179 -0
  165. package/start.ingbusiness.pl/scripts/Psd2AliasCtrl.js +12 -0
  166. package/start.ingbusiness.pl/scripts/RegonValidator.js +73 -0
  167. package/start.ingbusiness.pl/scripts/RequestService.js +26 -0
  168. package/start.ingbusiness.pl/scripts/SmsCtrl.js +91 -0
  169. package/start.ingbusiness.pl/scripts/UnlockUserCtrl.js +79 -0
  170. package/start.ingbusiness.pl/scripts/angular-animate.min.js +1535 -0
  171. package/start.ingbusiness.pl/scripts/angular-cookies.min.js +62 -0
  172. package/start.ingbusiness.pl/scripts/angular-translate.min.js +871 -0
  173. package/start.ingbusiness.pl/scripts/angular-ui-router.js +1561 -0
  174. package/start.ingbusiness.pl/scripts/angular.min.js +9845 -0
  175. package/start.ingbusiness.pl/scripts/criticalMessageService.js +24 -0
  176. package/start.ingbusiness.pl/scripts/data-dir-button-loader.js +30 -0
  177. package/start.ingbusiness.pl/scripts/data-dir-compile-template.js +17 -0
  178. package/start.ingbusiness.pl/scripts/data-dir-cookies-bar.js +37 -0
  179. package/start.ingbusiness.pl/scripts/data-dir-progress-pie.js +102 -0
  180. package/start.ingbusiness.pl/scripts/data-dir-svg-icon.js +633 -0
  181. package/start.ingbusiness.pl/scripts/data-gemius-event.js +119 -0
  182. package/start.ingbusiness.pl/scripts/dir-critical-message.js +9 -0
  183. package/start.ingbusiness.pl/scripts/dir-help-panel-content.js +29 -0
  184. package/start.ingbusiness.pl/scripts/dir-login-keyboard.js +346 -0
  185. package/start.ingbusiness.pl/scripts/dir-login-validation.js +20 -0
  186. package/start.ingbusiness.pl/scripts/dir-nav-links.js +26 -0
  187. package/start.ingbusiness.pl/scripts/dir-title.js +21 -0
  188. package/start.ingbusiness.pl/scripts/gemius-init.js +12 -0
  189. package/start.ingbusiness.pl/scripts/gemiusID.js +32 -0
  190. package/start.ingbusiness.pl/scripts/hashService.js +91 -0
  191. package/start.ingbusiness.pl/scripts/helpPanelPasswordService.js +26 -0
  192. package/start.ingbusiness.pl/scripts/helpPanelService.js +92 -0
  193. package/start.ingbusiness.pl/scripts/jquery-3.5.1.min.js +3242 -0
  194. package/start.ingbusiness.pl/scripts/login-app.js +107 -0
  195. package/start.ingbusiness.pl/scripts/login-en.js +73 -0
  196. package/start.ingbusiness.pl/scripts/login-pl.js +74 -0
  197. package/start.ingbusiness.pl/scripts/login-states.js +156 -0
  198. package/start.ingbusiness.pl/scripts/maskService.js +194 -0
  199. package/start.ingbusiness.pl/scripts/maskUtilService.js +302 -0
  200. package/start.ingbusiness.pl/scripts/mobileAuthCtrl.js +189 -0
  201. package/start.ingbusiness.pl/scripts/psd2-states.js +67 -0
  202. package/start.ingbusiness.pl/scripts/securityPolicyService.js +119 -0
  203. package/start.ingbusiness.pl/scripts/sgemius.js +257 -0
  204. package/start.ingbusiness.pl/scripts/sha1.js +210 -0
  205. package/start.ingbusiness.pl/scripts/sprintf.js +115 -0
  206. package/start.ingbusiness.pl/scripts/tabletScalingService.js +59 -0
  207. package/start.ingbusiness.pl/scripts/userAgentResolverService.js +12 -0
@@ -0,0 +1,700 @@
1
+ /*
2
+ * jQuery File Upload User Interface Plugin 9.5.2
3
+ * https://github.com/blueimp/jQuery-File-Upload
4
+ *
5
+ * Copyright 2010, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Licensed under the MIT license:
9
+ * http://www.opensource.org/licenses/MIT
10
+ */
11
+
12
+ /* jshint nomen:false */
13
+ /* global define, window */
14
+
15
+ (function(factory) {
16
+ 'use strict';
17
+ if (typeof define === 'function' && define.amd) {
18
+ // Register as an anonymous AMD module:
19
+ define([
20
+ 'jquery',
21
+ 'tmpl',
22
+ './jquery.fileupload-image',
23
+ './jquery.fileupload-audio',
24
+ './jquery.fileupload-video',
25
+ './jquery.fileupload-validate'
26
+ ], factory);
27
+ } else {
28
+ // Browser globals:
29
+ factory(
30
+ window.jQuery,
31
+ window.tmpl
32
+ );
33
+ }
34
+ }(function($, tmpl) {
35
+ 'use strict';
36
+
37
+ $.blueimp.fileupload.prototype._specialOptions.push(
38
+ 'filesContainer',
39
+ 'uploadTemplateId',
40
+ 'downloadTemplateId'
41
+ );
42
+
43
+ // The UI version extends the file upload widget
44
+ // and adds complete user interface interaction:
45
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
46
+
47
+ options: {
48
+ // By default, files added to the widget are uploaded as soon
49
+ // as the user clicks on the start buttons. To enable automatic
50
+ // uploads, set the following option to true:
51
+ autoUpload: false,
52
+ // The ID of the upload template:
53
+ uploadTemplateId: 'template-upload',
54
+ // The ID of the download template:
55
+ downloadTemplateId: 'template-download',
56
+ // The container for the list of files. If undefined, it is set to
57
+ // an element with class "files" inside of the widget element:
58
+ filesContainer: undefined,
59
+ // By default, files are appended to the files container.
60
+ // Set the following option to true, to prepend files instead:
61
+ prependFiles: false,
62
+ // The expected data type of the upload response, sets the dataType
63
+ // option of the $.ajax upload requests:
64
+ dataType: 'json',
65
+
66
+ // Function returning the current number of files,
67
+ // used by the maxNumberOfFiles validation:
68
+ getNumberOfFiles: function() {
69
+ return this.filesContainer.children()
70
+ .not('.processing').length;
71
+ },
72
+
73
+ // Callback to retrieve the list of files from the server response:
74
+ getFilesFromResponse: function(data) {
75
+ if (data.result && $.isArray(data.result.files)) {
76
+ return data.result.files;
77
+ }
78
+ return [];
79
+ },
80
+
81
+ // The add callback is invoked as soon as files are added to the fileupload
82
+ // widget (via file input selection, drag & drop or add API call).
83
+ // See the basic file upload widget for more information:
84
+ add: function(e, data) {
85
+ if (e.isDefaultPrevented()) {
86
+ return false;
87
+ }
88
+ var $this = $(this),
89
+ that = $this.data('blueimp-fileupload') ||
90
+ $this.data('fileupload'),
91
+ options = that.options;
92
+ data.context = that._renderUpload(data.files)
93
+ .data('data', data)
94
+ .addClass('processing');
95
+ options.filesContainer[
96
+ options.prependFiles ? 'prepend' : 'append'
97
+ ](data.context);
98
+ that._forceReflow(data.context);
99
+ that._transition(data.context);
100
+ data.process(function() {
101
+ return $this.fileupload('process', data);
102
+ }).always(function() {
103
+ data.context.each(function(index) {
104
+ $(this).find('.size').text(
105
+ that._formatFileSize(data.files[index].size)
106
+ );
107
+ }).removeClass('processing');
108
+ that._renderPreviews(data);
109
+ }).done(function() {
110
+ data.context.find('.start').prop('disabled', false);
111
+ if ((that._trigger('added', e, data) !== false) &&
112
+ (options.autoUpload || data.autoUpload) &&
113
+ data.autoUpload !== false) {
114
+ data.submit();
115
+ }
116
+ }).fail(function() {
117
+ if (data.files.error) {
118
+ data.context.each(function(index) {
119
+ var error = data.files[index].error;
120
+ if (error) {
121
+ $(this).find('.error').text(error);
122
+ }
123
+ });
124
+ }
125
+ });
126
+ },
127
+ // Callback for the start of each file upload request:
128
+ send: function(e, data) {
129
+ if (e.isDefaultPrevented()) {
130
+ return false;
131
+ }
132
+ var that = $(this).data('blueimp-fileupload') ||
133
+ $(this).data('fileupload');
134
+ if (data.context && data.dataType &&
135
+ data.dataType.substr(0, 6) === 'iframe') {
136
+ // Iframe Transport does not support progress events.
137
+ // In lack of an indeterminate progress bar, we set
138
+ // the progress to 100%, showing the full animated bar:
139
+ data.context
140
+ .find('.progress').addClass(
141
+ !$.support.transition && 'progress-animated'
142
+ )
143
+ .attr('aria-valuenow', 100)
144
+ .children().first().css(
145
+ 'width',
146
+ '100%'
147
+ );
148
+ }
149
+ return that._trigger('sent', e, data);
150
+ },
151
+ // Callback for successful uploads:
152
+ done: function(e, data) {
153
+ if (e.isDefaultPrevented()) {
154
+ return false;
155
+ }
156
+ var that = $(this).data('blueimp-fileupload') ||
157
+ $(this).data('fileupload'),
158
+ getFilesFromResponse = data.getFilesFromResponse ||
159
+ that.options.getFilesFromResponse,
160
+ files = getFilesFromResponse(data),
161
+ template,
162
+ deferred;
163
+ if (data.context) {
164
+ data.context.each(function(index) {
165
+ var file = files[index] || {
166
+ error: 'Empty file upload result'
167
+ };
168
+ deferred = that._addFinishedDeferreds();
169
+ that._transition($(this)).done(
170
+ function() {
171
+ var node = $(this);
172
+ template = that._renderDownload([file])
173
+ .replaceAll(node);
174
+ that._forceReflow(template);
175
+ that._transition(template).done(
176
+ function() {
177
+ data.context = $(this);
178
+ that._trigger('completed', e, data);
179
+ that._trigger('finished', e, data);
180
+ deferred.resolve();
181
+ }
182
+ );
183
+ }
184
+ );
185
+ });
186
+ } else {
187
+ template = that._renderDownload(files)[
188
+ that.options.prependFiles ? 'prependTo' : 'appendTo'
189
+ ](that.options.filesContainer);
190
+ that._forceReflow(template);
191
+ deferred = that._addFinishedDeferreds();
192
+ that._transition(template).done(
193
+ function() {
194
+ data.context = $(this);
195
+ that._trigger('completed', e, data);
196
+ that._trigger('finished', e, data);
197
+ deferred.resolve();
198
+ }
199
+ );
200
+ }
201
+ },
202
+ // Callback for failed (abort or error) uploads:
203
+ fail: function(e, data) {
204
+ if (e.isDefaultPrevented()) {
205
+ return false;
206
+ }
207
+ var that = $(this).data('blueimp-fileupload') ||
208
+ $(this).data('fileupload'),
209
+ template,
210
+ deferred;
211
+ if (data.context) {
212
+ data.context.each(function(index) {
213
+ if (data.errorThrown !== 'abort') {
214
+ var file = data.files[index];
215
+ file.error = file.error || data.errorThrown ||
216
+ true;
217
+ deferred = that._addFinishedDeferreds();
218
+ that._transition($(this)).done(
219
+ function() {
220
+ var node = $(this);
221
+ template = that._renderDownload([file])
222
+ .replaceAll(node);
223
+ that._forceReflow(template);
224
+ that._transition(template).done(
225
+ function() {
226
+ data.context = $(this);
227
+ that._trigger('failed', e, data);
228
+ that._trigger('finished', e, data);
229
+ deferred.resolve();
230
+ }
231
+ );
232
+ }
233
+ );
234
+ } else {
235
+ deferred = that._addFinishedDeferreds();
236
+ that._transition($(this)).done(
237
+ function() {
238
+ $(this).remove();
239
+ that._trigger('failed', e, data);
240
+ that._trigger('finished', e, data);
241
+ deferred.resolve();
242
+ }
243
+ );
244
+ }
245
+ });
246
+ } else if (data.errorThrown !== 'abort') {
247
+ data.context = that._renderUpload(data.files)[
248
+ that.options.prependFiles ? 'prependTo' : 'appendTo'
249
+ ](that.options.filesContainer)
250
+ .data('data', data);
251
+ that._forceReflow(data.context);
252
+ deferred = that._addFinishedDeferreds();
253
+ that._transition(data.context).done(
254
+ function() {
255
+ data.context = $(this);
256
+ that._trigger('failed', e, data);
257
+ that._trigger('finished', e, data);
258
+ deferred.resolve();
259
+ }
260
+ );
261
+ } else {
262
+ that._trigger('failed', e, data);
263
+ that._trigger('finished', e, data);
264
+ that._addFinishedDeferreds().resolve();
265
+ }
266
+ },
267
+ // Callback for upload progress events:
268
+ progress: function(e, data) {
269
+ if (e.isDefaultPrevented()) {
270
+ return false;
271
+ }
272
+ var progress = Math.floor(data.loaded / data.total * 100);
273
+ if (data.context) {
274
+ data.context.each(function() {
275
+ $(this).find('.progress')
276
+ .attr('aria-valuenow', progress)
277
+ .children().first().css(
278
+ 'width',
279
+ progress + '%'
280
+ );
281
+ });
282
+ }
283
+ },
284
+ // Callback for global upload progress events:
285
+ progressall: function(e, data) {
286
+ if (e.isDefaultPrevented()) {
287
+ return false;
288
+ }
289
+ var $this = $(this),
290
+ progress = Math.floor(data.loaded / data.total * 100),
291
+ globalProgressNode = $this.find('.fileupload-progress'),
292
+ extendedProgressNode = globalProgressNode
293
+ .find('.progress-extended');
294
+ if (extendedProgressNode.length) {
295
+ extendedProgressNode.html(
296
+ ($this.data('blueimp-fileupload') || $this.data('fileupload'))
297
+ ._renderExtendedProgress(data)
298
+ );
299
+ }
300
+ globalProgressNode
301
+ .find('.progress')
302
+ .attr('aria-valuenow', progress)
303
+ .children().first().css(
304
+ 'width',
305
+ progress + '%'
306
+ );
307
+ },
308
+ // Callback for uploads start, equivalent to the global ajaxStart event:
309
+ start: function(e) {
310
+ if (e.isDefaultPrevented()) {
311
+ return false;
312
+ }
313
+ var that = $(this).data('blueimp-fileupload') ||
314
+ $(this).data('fileupload');
315
+ that._resetFinishedDeferreds();
316
+ that._transition($(this).find('.fileupload-progress')).done(
317
+ function() {
318
+ that._trigger('started', e);
319
+ }
320
+ );
321
+ },
322
+ // Callback for uploads stop, equivalent to the global ajaxStop event:
323
+ stop: function(e) {
324
+ if (e.isDefaultPrevented()) {
325
+ return false;
326
+ }
327
+ var that = $(this).data('blueimp-fileupload') ||
328
+ $(this).data('fileupload'),
329
+ deferred = that._addFinishedDeferreds();
330
+ $.when.apply($, that._getFinishedDeferreds())
331
+ .done(function() {
332
+ that._trigger('stopped', e);
333
+ });
334
+ that._transition($(this).find('.fileupload-progress')).done(
335
+ function() {
336
+ $(this).find('.progress')
337
+ .attr('aria-valuenow', '0')
338
+ .children().first().css('width', '0%');
339
+ $(this).find('.progress-extended').html(' ');
340
+ deferred.resolve();
341
+ }
342
+ );
343
+ },
344
+ processstart: function(e) {
345
+ if (e.isDefaultPrevented()) {
346
+ return false;
347
+ }
348
+ $(this).addClass('fileupload-processing');
349
+ },
350
+ processstop: function(e) {
351
+ if (e.isDefaultPrevented()) {
352
+ return false;
353
+ }
354
+ $(this).removeClass('fileupload-processing');
355
+ },
356
+ // Callback for file deletion:
357
+ destroy: function(e, data) {
358
+ if (e.isDefaultPrevented()) {
359
+ return false;
360
+ }
361
+ var that = $(this).data('blueimp-fileupload') ||
362
+ $(this).data('fileupload'),
363
+ removeNode = function() {
364
+ that._transition(data.context).done(
365
+ function() {
366
+ $(this).remove();
367
+ that._trigger('destroyed', e, data);
368
+ }
369
+ );
370
+ };
371
+ if (data.url) {
372
+ data.dataType = data.dataType || that.options.dataType;
373
+ $.ajax(data).done(removeNode).fail(function() {
374
+ that._trigger('destroyfailed', e, data);
375
+ });
376
+ } else {
377
+ removeNode();
378
+ }
379
+ }
380
+ },
381
+
382
+ _resetFinishedDeferreds: function() {
383
+ this._finishedUploads = [];
384
+ },
385
+
386
+ _addFinishedDeferreds: function(deferred) {
387
+ if (!deferred) {
388
+ deferred = $.Deferred();
389
+ }
390
+ this._finishedUploads.push(deferred);
391
+ return deferred;
392
+ },
393
+
394
+ _getFinishedDeferreds: function() {
395
+ return this._finishedUploads;
396
+ },
397
+
398
+ // Link handler, that allows to download files
399
+ // by drag & drop of the links to the desktop:
400
+ _enableDragToDesktop: function() {
401
+ var link = $(this),
402
+ url = link.prop('href'),
403
+ name = link.prop('download'),
404
+ type = 'application/octet-stream';
405
+ link.bind('dragstart', function(e) {
406
+ try {
407
+ e.originalEvent.dataTransfer.setData(
408
+ 'DownloadURL',
409
+ [type, name, url].join(':')
410
+ );
411
+ } catch (ignore) {}
412
+ });
413
+ },
414
+
415
+ _formatFileSize: function(bytes) {
416
+ if (typeof bytes !== 'number') {
417
+ return '';
418
+ }
419
+ if (bytes >= 1000000000) {
420
+ return (bytes / 1000000000).toFixed(2) + ' GB';
421
+ }
422
+ if (bytes >= 1000000) {
423
+ return (bytes / 1000000).toFixed(2) + ' MB';
424
+ }
425
+ return (bytes / 1000).toFixed(2) + ' KB';
426
+ },
427
+
428
+ _formatBitrate: function(bits) {
429
+ if (typeof bits !== 'number') {
430
+ return '';
431
+ }
432
+ if (bits >= 1000000000) {
433
+ return (bits / 1000000000).toFixed(2) + ' Gbit/s';
434
+ }
435
+ if (bits >= 1000000) {
436
+ return (bits / 1000000).toFixed(2) + ' Mbit/s';
437
+ }
438
+ if (bits >= 1000) {
439
+ return (bits / 1000).toFixed(2) + ' kbit/s';
440
+ }
441
+ return bits.toFixed(2) + ' bit/s';
442
+ },
443
+
444
+ _formatTime: function(seconds) {
445
+ var date = new Date(seconds * 1000),
446
+ days = Math.floor(seconds / 86400);
447
+ days = days ? days + 'd ' : '';
448
+ return days +
449
+ ('0' + date.getUTCHours()).slice(-2) + ':' +
450
+ ('0' + date.getUTCMinutes()).slice(-2) + ':' +
451
+ ('0' + date.getUTCSeconds()).slice(-2);
452
+ },
453
+
454
+ _formatPercentage: function(floatValue) {
455
+ return (floatValue * 100).toFixed(2) + ' %';
456
+ },
457
+
458
+ _renderExtendedProgress: function(data) {
459
+ return this._formatBitrate(data.bitrate) + ' | ' +
460
+ this._formatTime(
461
+ (data.total - data.loaded) * 8 / data.bitrate
462
+ ) + ' | ' +
463
+ this._formatPercentage(
464
+ data.loaded / data.total
465
+ ) + ' | ' +
466
+ this._formatFileSize(data.loaded) + ' / ' +
467
+ this._formatFileSize(data.total);
468
+ },
469
+
470
+ _renderTemplate: function(func, files) {
471
+ if (!func) {
472
+ return $();
473
+ }
474
+ var result = func({
475
+ files: files,
476
+ formatFileSize: this._formatFileSize,
477
+ options: this.options
478
+ });
479
+ if (result instanceof $) {
480
+ return result;
481
+ }
482
+ return $(this.options.templatesContainer).html(result).children();
483
+ },
484
+
485
+ _renderPreviews: function(data) {
486
+ data.context.find('.preview').each(function(index, elm) {
487
+ $(elm).html(data.files[index].preview);
488
+ });
489
+ },
490
+
491
+ _renderUpload: function(files) {
492
+ return this._renderTemplate(
493
+ this.options.uploadTemplate,
494
+ files
495
+ );
496
+ },
497
+
498
+ _renderDownload: function(files) {
499
+ return this._renderTemplate(
500
+ this.options.downloadTemplate,
501
+ files
502
+ ).find('a[download]').each(this._enableDragToDesktop).end();
503
+ },
504
+
505
+ _startHandler: function(e) {
506
+ e.preventDefault();
507
+ var button = $(e.currentTarget),
508
+ template = button.closest('.template-upload'),
509
+ data = template.data('data');
510
+ button.prop('disabled', true);
511
+ if (data && data.submit) {
512
+ data.submit();
513
+ }
514
+ },
515
+
516
+ _cancelHandler: function(e) {
517
+ e.preventDefault();
518
+ var template = $(e.currentTarget)
519
+ .closest('.template-upload,.template-download'),
520
+ data = template.data('data') || {};
521
+ data.context = data.context || template;
522
+ if (data.abort) {
523
+ data.abort();
524
+ } else {
525
+ data.errorThrown = 'abort';
526
+ this._trigger('fail', e, data);
527
+ }
528
+ },
529
+
530
+ _deleteHandler: function(e) {
531
+ e.preventDefault();
532
+ var button = $(e.currentTarget);
533
+ this._trigger('destroy', e, $.extend({
534
+ context: button.closest('.template-download'),
535
+ type: 'DELETE'
536
+ }, button.data()));
537
+ },
538
+
539
+ _forceReflow: function(node) {
540
+ return $.support.transition && node.length &&
541
+ node[0].offsetWidth;
542
+ },
543
+
544
+ _transition: function(node) {
545
+ var dfd = $.Deferred();
546
+ if ($.support.transition && node.hasClass('fade') && node.is(':visible')) {
547
+ node.bind(
548
+ $.support.transition.end,
549
+ function(e) {
550
+ // Make sure we don't respond to other transitions events
551
+ // in the container element, e.g. from button elements:
552
+ if (e.target === node[0]) {
553
+ node.unbind($.support.transition.end);
554
+ dfd.resolveWith(node);
555
+ }
556
+ }
557
+ ).toggleClass('in');
558
+ } else {
559
+ node.toggleClass('in');
560
+ dfd.resolveWith(node);
561
+ }
562
+ return dfd;
563
+ },
564
+
565
+ _initButtonBarEventHandlers: function() {
566
+ var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'),
567
+ filesList = this.options.filesContainer;
568
+ this._on(fileUploadButtonBar.find('.start'), {
569
+ click: function(e) {
570
+ e.preventDefault();
571
+ filesList.find('.start').click();
572
+ }
573
+ });
574
+ this._on(fileUploadButtonBar.find('.cancel'), {
575
+ click: function(e) {
576
+ e.preventDefault();
577
+ filesList.find('.cancel').click();
578
+ }
579
+ });
580
+ this._on(fileUploadButtonBar.find('.delete'), {
581
+ click: function(e) {
582
+ e.preventDefault();
583
+ filesList.find('.toggle:checked')
584
+ .closest('.template-download')
585
+ .find('.delete').click();
586
+ fileUploadButtonBar.find('.toggle')
587
+ .prop('checked', false);
588
+ }
589
+ });
590
+ this._on(fileUploadButtonBar.find('.toggle'), {
591
+ change: function(e) {
592
+ filesList.find('.toggle').prop(
593
+ 'checked',
594
+ $(e.currentTarget).is(':checked')
595
+ );
596
+ }
597
+ });
598
+ },
599
+
600
+ _destroyButtonBarEventHandlers: function() {
601
+ this._off(
602
+ this.element.find('.fileupload-buttonbar')
603
+ .find('.start, .cancel, .delete'),
604
+ 'click'
605
+ );
606
+ this._off(
607
+ this.element.find('.fileupload-buttonbar .toggle'),
608
+ 'change.'
609
+ );
610
+ },
611
+
612
+ _initEventHandlers: function() {
613
+ this._super();
614
+ this._on(this.options.filesContainer, {
615
+ 'click .start': this._startHandler,
616
+ 'click .cancel': this._cancelHandler,
617
+ 'click .delete': this._deleteHandler
618
+ });
619
+ this._initButtonBarEventHandlers();
620
+ },
621
+
622
+ _destroyEventHandlers: function() {
623
+ this._destroyButtonBarEventHandlers();
624
+ this._off(this.options.filesContainer, 'click');
625
+ this._super();
626
+ },
627
+
628
+ _enableFileInputButton: function() {
629
+ this.element.find('.fileinput-button input')
630
+ .prop('disabled', false)
631
+ .parent().removeClass('disabled');
632
+ },
633
+
634
+ _disableFileInputButton: function() {
635
+ this.element.find('.fileinput-button input')
636
+ .prop('disabled', true)
637
+ .parent().addClass('disabled');
638
+ },
639
+
640
+ _initTemplates: function() {
641
+ var options = this.options;
642
+ options.templatesContainer = this.document[0].createElement(
643
+ options.filesContainer.prop('nodeName')
644
+ );
645
+ if (tmpl) {
646
+ if (options.uploadTemplateId) {
647
+ options.uploadTemplate = tmpl(options.uploadTemplateId);
648
+ }
649
+ if (options.downloadTemplateId) {
650
+ options.downloadTemplate = tmpl(options.downloadTemplateId);
651
+ }
652
+ }
653
+ },
654
+
655
+ _initFilesContainer: function() {
656
+ var options = this.options;
657
+ if (options.filesContainer === undefined) {
658
+ options.filesContainer = this.element.find('.files');
659
+ } else if (!(options.filesContainer instanceof $)) {
660
+ options.filesContainer = $(options.filesContainer);
661
+ }
662
+ },
663
+
664
+ _initSpecialOptions: function() {
665
+ this._super();
666
+ this._initFilesContainer();
667
+ this._initTemplates();
668
+ },
669
+
670
+ _create: function() {
671
+ this._super();
672
+ this._resetFinishedDeferreds();
673
+ if (!$.support.fileInput) {
674
+ this._disableFileInputButton();
675
+ }
676
+ },
677
+
678
+ enable: function() {
679
+ var wasDisabled = false;
680
+ if (this.options.disabled) {
681
+ wasDisabled = true;
682
+ }
683
+ this._super();
684
+ if (wasDisabled) {
685
+ this.element.find('input, button').prop('disabled', false);
686
+ this._enableFileInputButton();
687
+ }
688
+ },
689
+
690
+ disable: function() {
691
+ if (!this.options.disabled) {
692
+ this.element.find('input, button').prop('disabled', true);
693
+ this._disableFileInputButton();
694
+ }
695
+ this._super();
696
+ }
697
+
698
+ });
699
+
700
+ }));