aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-10 14:18:18 +0100
committerMario <mario@mariovavti.com>2019-11-10 14:18:18 +0100
commite1b923ab7d9070631b9bcf24fe1c42678f827169 (patch)
tree402fc0be56a0000701d969697ba1f271a66b8413 /vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js
parentbed9876d68ac72a27f3c05fa3ed5c4ccad39b72e (diff)
parent580c3f4ffe9608d2beb56d418c68b3b112420e76 (diff)
downloadvolse-hubzilla-e1b923ab7d9070631b9bcf24fe1c42678f827169.tar.gz
volse-hubzilla-e1b923ab7d9070631b9bcf24fe1c42678f827169.tar.bz2
volse-hubzilla-e1b923ab7d9070631b9bcf24fe1c42678f827169.zip
Merge branch 'cherry-pick-6685381f' into 'dev'
another bulk of composer updates See merge request hubzilla/core!1781
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.js289
1 files changed, 143 insertions, 146 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 638f0d26b..54d216913 100644
--- a/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js
+++ b/vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js
@@ -9,170 +9,167 @@
* https://opensource.org/licenses/MIT
*/
-/* jshint nomen:false */
-/* global define, require, window */
+/* global define, require */
-;(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define([
- 'jquery',
- './jquery.fileupload'
- ], factory);
- } else if (typeof exports === 'object') {
- // Node/CommonJS:
- factory(
- require('jquery'),
- require('./jquery.fileupload')
- );
- } else {
- // Browser globals:
- factory(
- window.jQuery
- );
- }
-}(function ($) {
- 'use strict';
-
- var originalAdd = $.blueimp.fileupload.prototype.options.add;
+(function(factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define(['jquery', './jquery.fileupload'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(require('jquery'), require('./jquery.fileupload'));
+ } else {
+ // Browser globals:
+ factory(window.jQuery);
+ }
+})(function($) {
+ 'use strict';
- // The File Upload Processing plugin extends the fileupload widget
- // with file processing functionality:
- $.widget('blueimp.fileupload', $.blueimp.fileupload, {
+ var originalAdd = $.blueimp.fileupload.prototype.options.add;
- options: {
- // The list of processing actions:
- processQueue: [
- /*
+ // The File Upload Processing plugin extends the fileupload widget
+ // with file processing functionality:
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
+ options: {
+ // The list of processing actions:
+ processQueue: [
+ /*
{
action: 'log',
type: 'debug'
}
*/
- ],
- add: function (e, data) {
- var $this = $(this);
- data.process(function () {
- return $this.fileupload('process', data);
- });
- originalAdd.call(this, e, data);
- }
- },
+ ],
+ add: function(e, data) {
+ var $this = $(this);
+ data.process(function() {
+ return $this.fileupload('process', data);
+ });
+ originalAdd.call(this, e, data);
+ }
+ },
- processActions: {
- /*
+ processActions: {
+ /*
log: function (data, options) {
console[options.type](
'Processing "' + data.files[data.index].name + '"'
);
}
*/
- },
-
- _processFile: function (data, originalData) {
- var that = this,
- dfd = $.Deferred().resolveWith(that, [data]),
- chain = dfd.promise();
- this._trigger('process', null, data);
- $.each(data.processQueue, function (i, settings) {
- var func = function (data) {
- if (originalData.errorThrown) {
- return $.Deferred()
- .rejectWith(that, [originalData]).promise();
- }
- return that.processActions[settings.action].call(
- that,
- data,
- settings
- );
- };
- chain = chain.then(func, settings.always && func);
- });
- chain
- .done(function () {
- that._trigger('processdone', null, data);
- that._trigger('processalways', null, data);
- })
- .fail(function () {
- that._trigger('processfail', null, data);
- that._trigger('processalways', null, data);
- });
- return chain;
- },
-
- // Replaces the settings of each processQueue item that
- // 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) {
- var processQueue = [];
- $.each(options.processQueue, function () {
- var settings = {},
- action = this.action,
- prefix = this.prefix === true ? action : this.prefix;
- $.each(this, function (key, value) {
- if ($.type(value) === 'string' &&
- value.charAt(0) === '@') {
- settings[key] = options[
- value.slice(1) || (prefix ? prefix +
- key.charAt(0).toUpperCase() + key.slice(1) : key)
- ];
- } else {
- settings[key] = value;
- }
+ },
- });
- processQueue.push(settings);
- });
- options.processQueue = processQueue;
- },
+ _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) {
+ if (originalData.errorThrown) {
+ // eslint-disable-next-line new-cap
+ return $.Deferred()
+ .rejectWith(that, [originalData])
+ .promise();
+ }
+ return that.processActions[settings.action].call(
+ that,
+ data,
+ settings
+ );
+ };
+ chain = chain.then(func, settings.always && func);
+ });
+ chain
+ .done(function() {
+ that._trigger('processdone', null, data);
+ that._trigger('processalways', null, data);
+ })
+ .fail(function() {
+ that._trigger('processfail', null, data);
+ that._trigger('processalways', null, data);
+ });
+ return chain;
+ },
- // Returns the number of files currently in the processsing queue:
- processing: function () {
- return this._processing;
- },
+ // Replaces the settings of each processQueue item that
+ // 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) {
+ var processQueue = [];
+ $.each(options.processQueue, function() {
+ var settings = {},
+ action = this.action,
+ prefix = this.prefix === true ? action : this.prefix;
+ $.each(this, function(key, value) {
+ if ($.type(value) === 'string' && value.charAt(0) === '@') {
+ settings[key] =
+ options[
+ value.slice(1) ||
+ (prefix
+ ? prefix + key.charAt(0).toUpperCase() + key.slice(1)
+ : key)
+ ];
+ } else {
+ settings[key] = value;
+ }
+ });
+ processQueue.push(settings);
+ });
+ options.processQueue = processQueue;
+ },
- // Processes the files given as files property of the data parameter,
- // returns a Promise object that allows to bind callbacks:
- process: function (data) {
- var that = this,
- options = $.extend({}, this.options, data);
- if (options.processQueue && options.processQueue.length) {
- this._transformProcessQueue(options);
- if (this._processing === 0) {
- this._trigger('processstart');
- }
- $.each(data.files, function (index) {
- var opts = index ? $.extend({}, options) : options,
- func = function () {
- if (data.errorThrown) {
- return $.Deferred()
- .rejectWith(that, [data]).promise();
- }
- return that._processFile(opts, data);
- };
- opts.index = index;
- that._processing += 1;
- that._processingQueue = that._processingQueue.then(func, func)
- .always(function () {
- that._processing -= 1;
- if (that._processing === 0) {
- that._trigger('processstop');
- }
- });
- });
- }
- return this._processingQueue;
- },
+ // Returns the number of files currently in the processsing queue:
+ processing: function() {
+ return this._processing;
+ },
- _create: function () {
- this._super();
- this._processing = 0;
- this._processingQueue = $.Deferred().resolveWith(this)
- .promise();
+ // Processes the files given as files property of the data parameter,
+ // returns a Promise object that allows to bind callbacks:
+ process: function(data) {
+ var that = this,
+ options = $.extend({}, this.options, data);
+ if (options.processQueue && options.processQueue.length) {
+ this._transformProcessQueue(options);
+ if (this._processing === 0) {
+ this._trigger('processstart');
}
+ $.each(data.files, function(index) {
+ var opts = index ? $.extend({}, options) : options,
+ func = function() {
+ if (data.errorThrown) {
+ // eslint-disable-next-line new-cap
+ return $.Deferred()
+ .rejectWith(that, [data])
+ .promise();
+ }
+ return that._processFile(opts, data);
+ };
+ opts.index = index;
+ that._processing += 1;
+ that._processingQueue = that._processingQueue
+ .then(func, func)
+ .always(function() {
+ that._processing -= 1;
+ if (that._processing === 0) {
+ that._trigger('processstop');
+ }
+ });
+ });
+ }
+ return this._processingQueue;
+ },
- });
-
-}));
+ _create: function() {
+ this._super();
+ this._processing = 0;
+ // eslint-disable-next-line new-cap
+ this._processingQueue = $.Deferred()
+ .resolveWith(this)
+ .promise();
+ }
+ });
+});