aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js')
-rw-r--r--vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js48
1 files changed, 27 insertions, 21 deletions
diff --git a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js
index 29de8309a..54d216913 100644
--- a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js
+++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js
@@ -11,7 +11,7 @@
/* global define, require */
-(function (factory) {
+(function(factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
@@ -23,7 +23,7 @@
// Browser globals:
factory(window.jQuery);
}
-})(function ($) {
+})(function($) {
'use strict';
var originalAdd = $.blueimp.fileupload.prototype.options.add;
@@ -41,9 +41,9 @@
}
*/
],
- add: function (e, data) {
+ add: function(e, data) {
var $this = $(this);
- data.process(function () {
+ data.process(function() {
return $this.fileupload('process', data);
});
originalAdd.call(this, e, data);
@@ -60,17 +60,19 @@
*/
},
- _processFile: function (data, originalData) {
+ _processFile: function(data, originalData) {
var that = this,
// eslint-disable-next-line new-cap
dfd = $.Deferred().resolveWith(that, [data]),
chain = dfd.promise();
this._trigger('process', null, data);
- $.each(data.processQueue, function (i, settings) {
- var func = function (data) {
+ $.each(data.processQueue, function(i, settings) {
+ var func = function(data) {
if (originalData.errorThrown) {
// eslint-disable-next-line new-cap
- return $.Deferred().rejectWith(that, [originalData]).promise();
+ return $.Deferred()
+ .rejectWith(that, [originalData])
+ .promise();
}
return that.processActions[settings.action].call(
that,
@@ -81,11 +83,11 @@
chain = chain.then(func, settings.always && func);
});
chain
- .done(function () {
+ .done(function() {
that._trigger('processdone', null, data);
that._trigger('processalways', null, data);
})
- .fail(function () {
+ .fail(function() {
that._trigger('processfail', null, data);
that._trigger('processalways', null, data);
});
@@ -96,13 +98,13 @@
// are strings starting with an "@", using the remaining
// substring as key for the option map,
// e.g. "@autoUpload" is replaced with options.autoUpload:
- _transformProcessQueue: function (options) {
+ _transformProcessQueue: function(options) {
var processQueue = [];
- $.each(options.processQueue, function () {
+ $.each(options.processQueue, function() {
var settings = {},
action = this.action,
prefix = this.prefix === true ? action : this.prefix;
- $.each(this, function (key, value) {
+ $.each(this, function(key, value) {
if ($.type(value) === 'string' && value.charAt(0) === '@') {
settings[key] =
options[
@@ -121,13 +123,13 @@
},
// Returns the number of files currently in the processsing queue:
- processing: function () {
+ processing: function() {
return this._processing;
},
// Processes the files given as files property of the data parameter,
// returns a Promise object that allows to bind callbacks:
- process: function (data) {
+ process: function(data) {
var that = this,
options = $.extend({}, this.options, data);
if (options.processQueue && options.processQueue.length) {
@@ -135,12 +137,14 @@
if (this._processing === 0) {
this._trigger('processstart');
}
- $.each(data.files, function (index) {
+ $.each(data.files, function(index) {
var opts = index ? $.extend({}, options) : options,
- func = function () {
+ func = function() {
if (data.errorThrown) {
// eslint-disable-next-line new-cap
- return $.Deferred().rejectWith(that, [data]).promise();
+ return $.Deferred()
+ .rejectWith(that, [data])
+ .promise();
}
return that._processFile(opts, data);
};
@@ -148,7 +152,7 @@
that._processing += 1;
that._processingQueue = that._processingQueue
.then(func, func)
- .always(function () {
+ .always(function() {
that._processing -= 1;
if (that._processing === 0) {
that._trigger('processstop');
@@ -159,11 +163,13 @@
return this._processingQueue;
},
- _create: function () {
+ _create: function() {
this._super();
this._processing = 0;
// eslint-disable-next-line new-cap
- this._processingQueue = $.Deferred().resolveWith(this).promise();
+ this._processingQueue = $.Deferred()
+ .resolveWith(this)
+ .promise();
}
});
});