aboutsummaryrefslogtreecommitdiffstats
path: root/library/blueimp_upload/js/jquery.fileupload.js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-07-03 21:33:24 +0200
committerMario Vavti <mario@mariovavti.com>2017-07-03 21:33:24 +0200
commitd0961068247ce57ba0eb45afc078cacb44b87810 (patch)
treef9372689e943a522f4c0bd417d4458474aee0cfd /library/blueimp_upload/js/jquery.fileupload.js
parent562124c29f821b046bc4cf4b48a7bde39c70a07b (diff)
parent64cad0a041e44940f75bf351fc3755b3202f9029 (diff)
downloadvolse-hubzilla-d0961068247ce57ba0eb45afc078cacb44b87810.tar.gz
volse-hubzilla-d0961068247ce57ba0eb45afc078cacb44b87810.tar.bz2
volse-hubzilla-d0961068247ce57ba0eb45afc078cacb44b87810.zip
merge red into hubzilla
Diffstat (limited to 'library/blueimp_upload/js/jquery.fileupload.js')
-rw-r--r--library/blueimp_upload/js/jquery.fileupload.js71
1 files changed, 48 insertions, 23 deletions
diff --git a/library/blueimp_upload/js/jquery.fileupload.js b/library/blueimp_upload/js/jquery.fileupload.js
index a4cfdc0ac..5ff151b53 100644
--- a/library/blueimp_upload/js/jquery.fileupload.js
+++ b/library/blueimp_upload/js/jquery.fileupload.js
@@ -1,25 +1,31 @@
/*
- * jQuery File Upload Plugin 5.42.0
+ * jQuery File Upload Plugin
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
- * http://www.opensource.org/licenses/MIT
+ * https://opensource.org/licenses/MIT
*/
/* jshint nomen:false */
-/* global define, window, document, location, Blob, FormData */
+/* global define, require, window, document, location, Blob, FormData */
-(function (factory) {
+;(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define([
'jquery',
- 'jquery.ui.widget'
+ 'jquery-ui/ui/widget'
], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(
+ require('jquery'),
+ require('./vendor/jquery.ui.widget')
+ );
} else {
// Browser globals:
factory(window.jQuery);
@@ -271,7 +277,8 @@
// The following are jQuery ajax settings required for the file uploads:
processData: false,
contentType: false,
- cache: false
+ cache: false,
+ timeout: 0
},
// A list of options that require reinitializing event listeners and/or
@@ -645,7 +652,7 @@
data.process = function (resolveFunc, rejectFunc) {
if (resolveFunc || rejectFunc) {
data._processQueue = this._processQueue =
- (this._processQueue || getPromise([this])).pipe(
+ (this._processQueue || getPromise([this])).then(
function () {
if (data.errorThrown) {
return $.Deferred()
@@ -653,7 +660,7 @@
}
return getPromise(arguments);
}
- ).pipe(resolveFunc, rejectFunc);
+ ).then(resolveFunc, rejectFunc);
}
return this._processQueue || getPromise([this]);
};
@@ -938,9 +945,9 @@
if (this.options.limitConcurrentUploads > 1) {
slot = $.Deferred();
this._slots.push(slot);
- pipe = slot.pipe(send);
+ pipe = slot.then(send);
} else {
- this._sequence = this._sequence.pipe(send, send);
+ this._sequence = this._sequence.then(send, send);
pipe = this._sequence;
}
// Return the piped Promise object, enhanced with an abort method,
@@ -977,7 +984,10 @@
fileSet,
i,
j = 0;
- if (limitSize && (!filesLength || files[0].size === undefined)) {
+ if (!filesLength) {
+ return false;
+ }
+ if (limitSize && files[0].size === undefined) {
limitSize = undefined;
}
if (!(options.singleFileUploads || limit || limitSize) ||
@@ -1036,13 +1046,19 @@
_replaceFileInput: function (data) {
var input = data.fileInput,
- inputClone = input.clone(true);
+ inputClone = input.clone(true),
+ restoreFocus = input.is(document.activeElement);
// Add a reference for the new cloned file input to the data argument:
data.fileInputClone = inputClone;
$('<form></form>').append(inputClone)[0].reset();
// Detaching allows to insert the fileInput on another form
// without loosing the file input value:
input.after(inputClone).detach();
+ // If the fileInput had focus before it was detached,
+ // restore focus to the inputClone.
+ if (restoreFocus) {
+ inputClone.focus();
+ }
// Avoid memory leaks with the detached file input:
$.cleanData(input.unbind('remove'));
// Replace the original file input element in the fileInput
@@ -1064,6 +1080,8 @@
_handleFileTreeEntry: function (entry, path) {
var that = this,
dfd = $.Deferred(),
+ entries = [],
+ dirReader,
errorHandler = function (e) {
if (e && !e.entry) {
e.entry = entry;
@@ -1091,8 +1109,7 @@
readEntries();
}
}, errorHandler);
- },
- dirReader, entries = [];
+ };
path = path || '';
if (entry.isFile) {
if (entry._file) {
@@ -1123,7 +1140,7 @@
$.map(entries, function (entry) {
return that._handleFileTreeEntry(entry, path);
})
- ).pipe(function () {
+ ).then(function () {
return Array.prototype.concat.apply(
[],
arguments
@@ -1192,7 +1209,7 @@
return $.when.apply(
$,
$.map(fileInput, this._getSingleFileInputFiles)
- ).pipe(function () {
+ ).then(function () {
return Array.prototype.concat.apply(
[],
arguments
@@ -1295,6 +1312,10 @@
this._off(this.options.fileInput, 'change');
},
+ _destroy: function () {
+ this._destroyEventHandlers();
+ },
+
_setOption: function (key, value) {
var reinit = $.inArray(key, this._specialOptions) !== -1;
if (reinit) {
@@ -1338,15 +1359,19 @@
_initDataAttributes: function () {
var that = this,
options = this.options,
- clone = $(this.element[0].cloneNode(false));
+ data = this.element.data();
// Initialize options set via HTML5 data-attributes:
$.each(
- clone.data(),
- function (key, value) {
- var dataAttributeName = 'data-' +
- // Convert camelCase to hyphen-ated key:
- key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
- if (clone.attr(dataAttributeName)) {
+ this.element[0].attributes,
+ function (index, attr) {
+ var key = attr.name.toLowerCase(),
+ value;
+ if (/^data-/.test(key)) {
+ // Convert hyphen-ated key to camelCase:
+ key = key.slice(5).replace(/-[a-z]/g, function (str) {
+ return str.charAt(1).toUpperCase();
+ });
+ value = data[key];
if (that._isRegExpOption(key, value)) {
value = that._getRegExp(value);
}