Skip to content

Commit cf45bc4

Browse files
committed
Update all libraries
1 parent 0ff3c5b commit cf45bc4

16 files changed

+759
-298
lines changed

vendor/assets/images/loading.gif

100755100644
File mode changed.

vendor/assets/images/progressbar.gif

100755100644
File mode changed.

vendor/assets/javascripts/jquery-fileupload/cors/jquery.postmessage-transport.js

100755100644
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery postMessage Transport Plugin 1.1
2+
* jQuery postMessage Transport Plugin 1.1.1
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2011, Sebastian Tschan
@@ -64,8 +64,9 @@
6464
xhrUpload = options.xhr().upload;
6565
return {
6666
send: function (_, completeCallback) {
67+
counter += 1;
6768
var message = {
68-
id: 'postmessage-transport-' + (counter += 1)
69+
id: 'postmessage-transport-' + counter
6970
},
7071
eventName = 'message.' + message.id;
7172
iframe = $(

vendor/assets/javascripts/jquery-fileupload/cors/jquery.xdr-transport.js

100755100644
File mode changed.

vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-angular.js

100755100644
Lines changed: 113 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload AngularJS Plugin 1.0.1
2+
* jQuery File Upload AngularJS Plugin 1.4.4
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2013, Sebastian Tschan
@@ -10,20 +10,42 @@
1010
*/
1111

1212
/*jslint nomen: true, unparam: true */
13-
/*global angular */
13+
/*global define, angular */
1414

15-
(function () {
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+
'angular',
22+
'./jquery.fileupload-image',
23+
'./jquery.fileupload-audio',
24+
'./jquery.fileupload-video',
25+
'./jquery.fileupload-validate'
26+
], factory);
27+
} else {
28+
factory();
29+
}
30+
}(function () {
1631
'use strict';
1732

1833
angular.module('blueimp.fileupload', [])
1934

35+
// The fileUpload service provides configuration options
36+
// for the fileUpload directive and default handlers for
37+
// File Upload events:
2038
.provider('fileUpload', function () {
2139
var scopeApply = function () {
2240
var scope = angular.element(this)
23-
.fileupload('option', 'scope')();
24-
if (!scope.$$phase) {
41+
.fileupload('option', 'scope')(),
42+
$timeout = angular.injector(['ng'])
43+
.get('$timeout');
44+
// Safe apply, makes sure $apply is called
45+
// asynchronously outside of the $digest cycle:
46+
$timeout(function () {
2547
scope.$apply();
26-
}
48+
});
2749
},
2850
$config;
2951
$config = this.defaults = {
@@ -47,19 +69,22 @@
4769
submit = function () {
4870
return data.submit();
4971
};
72+
angular.forEach(data.files, function (file, index) {
73+
file._index = index;
74+
file.$state = function () {
75+
return data.state();
76+
};
77+
file.$progress = function () {
78+
return data.progress();
79+
};
80+
file.$response = function () {
81+
return data.response();
82+
};
83+
});
5084
file.$cancel = function () {
5185
scope.clear(data.files);
5286
return data.abort();
5387
};
54-
file.$state = function () {
55-
return data.state();
56-
};
57-
file.$progress = function () {
58-
return data.progress();
59-
};
60-
file.$response = function () {
61-
return data.response();
62-
};
6388
if (file.$state() === 'rejected') {
6489
file._$submit = submit;
6590
} else {
@@ -96,10 +121,11 @@
96121
if (data.errorThrown === 'abort') {
97122
return;
98123
}
99-
if (data.dataType.indexOf('json') === data.dataType.length - 4) {
124+
if (data.dataType &&
125+
data.dataType.indexOf('json') === data.dataType.length - 4) {
100126
try {
101127
data.result = angular.fromJson(data.jqXHR.responseText);
102-
} catch (err) {}
128+
} catch (ignore) {}
103129
}
104130
data.scope().$apply(function () {
105131
data.handleResponse.call(that, e, data);
@@ -112,7 +138,6 @@
112138
return this.scope().queue.length;
113139
},
114140
dataType: 'json',
115-
prependFiles: true,
116141
autoUpload: false
117142
};
118143
this.$get = [
@@ -124,8 +149,9 @@
124149
];
125150
})
126151

152+
// Format byte numbers to readable presentations:
127153
.provider('formatFileSizeFilter', function () {
128-
var $config = this.defaults = {
154+
var $config = {
129155
// Byte units following the IEC format
130156
// http://en.wikipedia.org/wiki/Kilobyte
131157
units: [
@@ -134,28 +160,58 @@
134160
{size: 1000, suffix: ' KB'}
135161
]
136162
};
163+
this.defaults = $config;
137164
this.$get = function () {
138165
return function (bytes) {
139166
if (!angular.isNumber(bytes)) {
140167
return '';
141168
}
142169
var unit = true,
143-
i = -1;
170+
i = 0,
171+
prefix,
172+
suffix;
144173
while (unit) {
145-
unit = $config.units[i += 1];
174+
unit = $config.units[i];
175+
prefix = unit.prefix || '';
176+
suffix = unit.suffix || '';
146177
if (i === $config.units.length - 1 || bytes >= unit.size) {
147-
return (bytes / unit.size).toFixed(2) + unit.suffix;
178+
return prefix + (bytes / unit.size).toFixed(2) + suffix;
148179
}
180+
i += 1;
149181
}
150182
};
151183
};
152184
})
153185

186+
// The FileUploadController initializes the fileupload widget and
187+
// provides scope methods to control the File Upload functionality:
154188
.controller('FileUploadController', [
155-
'$scope', '$element', '$attrs', 'fileUpload',
156-
function ($scope, $element, $attrs, fileUpload) {
157-
$scope.disabled = angular.element('<input type="file">')
158-
.prop('disabled');
189+
'$scope', '$element', '$attrs', '$window', 'fileUpload',
190+
function ($scope, $element, $attrs, $window, fileUpload) {
191+
var uploadMethods = {
192+
progress: function () {
193+
return $element.fileupload('progress');
194+
},
195+
active: function () {
196+
return $element.fileupload('active');
197+
},
198+
option: function (option, data) {
199+
return $element.fileupload('option', option, data);
200+
},
201+
add: function (data) {
202+
return $element.fileupload('add', data);
203+
},
204+
send: function (data) {
205+
return $element.fileupload('send', data);
206+
},
207+
process: function (data) {
208+
return $element.fileupload('process', data);
209+
},
210+
processing: function (data) {
211+
return $element.fileupload('processing', data);
212+
}
213+
};
214+
$scope.disabled = !$window.jQuery.support.fileInput;
159215
$scope.queue = $scope.queue || [];
160216
$scope.clear = function (files) {
161217
var queue = this.queue,
@@ -167,7 +223,8 @@
167223
length = files.length;
168224
}
169225
while (i) {
170-
if (queue[i -= 1] === file) {
226+
i -= 1;
227+
if (queue[i] === file) {
171228
return queue.splice(i, length);
172229
}
173230
}
@@ -186,27 +243,6 @@
186243
}
187244
}
188245
};
189-
$scope.progress = function () {
190-
return $element.fileupload('progress');
191-
};
192-
$scope.active = function () {
193-
return $element.fileupload('active');
194-
};
195-
$scope.option = function (option, data) {
196-
return $element.fileupload('option', option, data);
197-
};
198-
$scope.add = function (data) {
199-
return $element.fileupload('add', data);
200-
};
201-
$scope.send = function (data) {
202-
return $element.fileupload('send', data);
203-
};
204-
$scope.process = function (data) {
205-
return $element.fileupload('process', data);
206-
};
207-
$scope.processing = function (data) {
208-
return $element.fileupload('processing', data);
209-
};
210246
$scope.applyOnQueue = function (method) {
211247
var list = this.queue.slice(0),
212248
i,
@@ -224,6 +260,8 @@
224260
$scope.cancel = function () {
225261
this.applyOnQueue('$cancel');
226262
};
263+
// Add upload methods to the scope:
264+
angular.extend($scope, uploadMethods);
227265
// The fileupload widget will initialize with
228266
// the options provided via "data-"-parameters,
229267
// as well as those given via options object:
@@ -260,12 +298,23 @@
260298
'fileuploadprocessalways',
261299
'fileuploadprocessstop'
262300
].join(' '), function (e, data) {
263-
$scope.$emit(e.type, data);
301+
if ($scope.$emit(e.type, data).defaultPrevented) {
302+
e.preventDefault();
303+
}
304+
}).on('remove', function () {
305+
// Remove upload methods from the scope,
306+
// when the widget is removed:
307+
var method;
308+
for (method in uploadMethods) {
309+
if (uploadMethods.hasOwnProperty(method)) {
310+
delete $scope[method];
311+
}
312+
}
264313
});
265314
// Observe option changes:
266315
$scope.$watch(
267-
$attrs.fileupload,
268-
function (newOptions, oldOptions) {
316+
$attrs.fileUpload,
317+
function (newOptions) {
269318
if (newOptions) {
270319
$element.fileupload('option', newOptions);
271320
}
@@ -274,10 +323,11 @@
274323
}
275324
])
276325

326+
// Provide File Upload progress feedback:
277327
.controller('FileUploadProgressController', [
278328
'$scope', '$attrs', '$parse',
279329
function ($scope, $attrs, $parse) {
280-
var fn = $parse($attrs.progress),
330+
var fn = $parse($attrs.fileUploadProgress),
281331
update = function () {
282332
var progress = fn($scope);
283333
if (!progress || !progress.total) {
@@ -289,7 +339,7 @@
289339
};
290340
update();
291341
$scope.$watch(
292-
$attrs.progress + '.loaded',
342+
$attrs.fileUploadProgress + '.loaded',
293343
function (newValue, oldValue) {
294344
if (newValue !== oldValue) {
295345
update();
@@ -299,37 +349,40 @@
299349
}
300350
])
301351

352+
// Display File Upload previews:
302353
.controller('FileUploadPreviewController', [
303354
'$scope', '$element', '$attrs', '$parse',
304355
function ($scope, $element, $attrs, $parse) {
305-
var fn = $parse($attrs.preview),
356+
var fn = $parse($attrs.fileUploadPreview),
306357
file = fn($scope);
307358
if (file.preview) {
308359
$element.append(file.preview);
309360
}
310361
}
311362
])
312363

313-
.directive('fileupload', function () {
364+
.directive('fileUpload', function () {
314365
return {
315366
controller: 'FileUploadController'
316367
};
317368
})
318369

319-
.directive('progress', function () {
370+
.directive('fileUploadProgress', function () {
320371
return {
321372
controller: 'FileUploadProgressController'
322373
};
323374
})
324375

325-
.directive('preview', function () {
376+
.directive('fileUploadPreview', function () {
326377
return {
327378
controller: 'FileUploadPreviewController'
328379
};
329380
})
330381

382+
// Enhance the HTML5 download attribute to
383+
// allow drag&drop of files to the desktop:
331384
.directive('download', function () {
332-
return function (scope, elm, attrs) {
385+
return function (scope, elm) {
333386
elm.on('dragstart', function (e) {
334387
try {
335388
e.originalEvent.dataTransfer.setData(
@@ -340,9 +393,9 @@
340393
elm.prop('href')
341394
].join(':')
342395
);
343-
} catch (err) {}
396+
} catch (ignore) {}
344397
});
345398
};
346399
});
347400

348-
}());
401+
}));

0 commit comments

Comments
 (0)