(js) Update jQuery File Upload to version 9.12.5
This commit is contained in:
parent
1586180ebb
commit
23a5274881
1
NEWS
1
NEWS
|
@ -11,6 +11,7 @@ Enhancements
|
||||||
- [core] when restoring data using sogo-tool, regenerate Sieve script (#3029)
|
- [core] when restoring data using sogo-tool, regenerate Sieve script (#3029)
|
||||||
- [eas] use the preferred email identity in EAS if valid (#3698)
|
- [eas] use the preferred email identity in EAS if valid (#3698)
|
||||||
- [eas] handle inline attachments during EAS content generation
|
- [eas] handle inline attachments during EAS content generation
|
||||||
|
- [web] update jQuery File Upload library to 9.12.5
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
- [web] fixed crash when an attachment filename has no extension
|
- [web] fixed crash when an attachment filename has no extension
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@charset "UTF-8";
|
@charset "UTF-8";
|
||||||
/*
|
/*
|
||||||
* jQuery File Upload Plugin CSS 1.3.0
|
* jQuery File Upload Plugin CSS
|
||||||
* https://github.com/blueimp/jQuery-File-Upload
|
* https://github.com/blueimp/jQuery-File-Upload
|
||||||
*
|
*
|
||||||
* Copyright 2013, Sebastian Tschan
|
* Copyright 2013, Sebastian Tschan
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
.fileinput-button {
|
.fileinput-button {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
display: inline-block;
|
||||||
}
|
}
|
||||||
.fileinput-button input {
|
.fileinput-button input {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -21,7 +22,7 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
-ms-filter: 'alpha(opacity=0)';
|
-ms-filter: 'alpha(opacity=0)';
|
||||||
font-size: 200px;
|
font-size: 200px !important;
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
147
UI/WebServerResources/jquery.fileupload.js
vendored
147
UI/WebServerResources/jquery.fileupload.js
vendored
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* jQuery File Upload Plugin 5.40.1
|
* jQuery File Upload Plugin
|
||||||
* https://github.com/blueimp/jQuery-File-Upload
|
* https://github.com/blueimp/jQuery-File-Upload
|
||||||
*
|
*
|
||||||
* Copyright 2010, Sebastian Tschan
|
* Copyright 2010, Sebastian Tschan
|
||||||
|
@ -10,9 +10,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* jshint nomen:false */
|
/* jshint nomen:false */
|
||||||
/* global define, window, document, location, Blob, FormData */
|
/* global define, require, window, document, location, Blob, FormData */
|
||||||
|
|
||||||
(function (factory) {
|
;(function (factory) {
|
||||||
'use strict';
|
'use strict';
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
// Register as an anonymous AMD module:
|
// Register as an anonymous AMD module:
|
||||||
|
@ -20,6 +20,12 @@
|
||||||
'jquery',
|
'jquery',
|
||||||
'jquery.ui.widget'
|
'jquery.ui.widget'
|
||||||
], factory);
|
], factory);
|
||||||
|
} else if (typeof exports === 'object') {
|
||||||
|
// Node/CommonJS:
|
||||||
|
factory(
|
||||||
|
require('jquery'),
|
||||||
|
require('./vendor/jquery.ui.widget')
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// Browser globals:
|
// Browser globals:
|
||||||
factory(window.jQuery);
|
factory(window.jQuery);
|
||||||
|
@ -51,6 +57,25 @@
|
||||||
$.support.blobSlice = window.Blob && (Blob.prototype.slice ||
|
$.support.blobSlice = window.Blob && (Blob.prototype.slice ||
|
||||||
Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
|
Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
|
||||||
|
|
||||||
|
// Helper function to create drag handlers for dragover/dragenter/dragleave:
|
||||||
|
function getDragHandler(type) {
|
||||||
|
var isDragOver = type === 'dragover';
|
||||||
|
return function (e) {
|
||||||
|
e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
|
||||||
|
var dataTransfer = e.dataTransfer;
|
||||||
|
if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
|
||||||
|
this._trigger(
|
||||||
|
type,
|
||||||
|
$.Event(type, {delegatedEvent: e})
|
||||||
|
) !== false) {
|
||||||
|
e.preventDefault();
|
||||||
|
if (isDragOver) {
|
||||||
|
dataTransfer.dropEffect = 'copy';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// The fileupload widget listens for change events on file input fields defined
|
// The fileupload widget listens for change events on file input fields defined
|
||||||
// via fileInput setting and paste or drop events of the given dropZone.
|
// via fileInput setting and paste or drop events of the given dropZone.
|
||||||
// In addition to the default jQuery Widget methods, the fileupload widget
|
// In addition to the default jQuery Widget methods, the fileupload widget
|
||||||
|
@ -65,9 +90,9 @@
|
||||||
// The drop target element(s), by the default the complete document.
|
// The drop target element(s), by the default the complete document.
|
||||||
// Set to null to disable drag & drop support:
|
// Set to null to disable drag & drop support:
|
||||||
dropZone: $(document),
|
dropZone: $(document),
|
||||||
// The paste target element(s), by the default the complete document.
|
// The paste target element(s), by the default undefined.
|
||||||
// Set to null to disable paste support:
|
// Set to a DOM node or jQuery object to enable file pasting:
|
||||||
pasteZone: $(document),
|
pasteZone: undefined,
|
||||||
// The file input field(s), that are listened to for change events.
|
// The file input field(s), that are listened to for change events.
|
||||||
// If undefined, it is set to the file input fields inside
|
// If undefined, it is set to the file input fields inside
|
||||||
// of the widget element on plugin initialization.
|
// of the widget element on plugin initialization.
|
||||||
|
@ -252,7 +277,8 @@
|
||||||
// The following are jQuery ajax settings required for the file uploads:
|
// The following are jQuery ajax settings required for the file uploads:
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
cache: false
|
cache: false,
|
||||||
|
timeout: 0
|
||||||
},
|
},
|
||||||
|
|
||||||
// A list of options that require reinitializing event listeners and/or
|
// A list of options that require reinitializing event listeners and/or
|
||||||
|
@ -626,7 +652,7 @@
|
||||||
data.process = function (resolveFunc, rejectFunc) {
|
data.process = function (resolveFunc, rejectFunc) {
|
||||||
if (resolveFunc || rejectFunc) {
|
if (resolveFunc || rejectFunc) {
|
||||||
data._processQueue = this._processQueue =
|
data._processQueue = this._processQueue =
|
||||||
(this._processQueue || getPromise([this])).pipe(
|
(this._processQueue || getPromise([this])).then(
|
||||||
function () {
|
function () {
|
||||||
if (data.errorThrown) {
|
if (data.errorThrown) {
|
||||||
return $.Deferred()
|
return $.Deferred()
|
||||||
|
@ -634,7 +660,7 @@
|
||||||
}
|
}
|
||||||
return getPromise(arguments);
|
return getPromise(arguments);
|
||||||
}
|
}
|
||||||
).pipe(resolveFunc, rejectFunc);
|
).then(resolveFunc, rejectFunc);
|
||||||
}
|
}
|
||||||
return this._processQueue || getPromise([this]);
|
return this._processQueue || getPromise([this]);
|
||||||
};
|
};
|
||||||
|
@ -919,9 +945,9 @@
|
||||||
if (this.options.limitConcurrentUploads > 1) {
|
if (this.options.limitConcurrentUploads > 1) {
|
||||||
slot = $.Deferred();
|
slot = $.Deferred();
|
||||||
this._slots.push(slot);
|
this._slots.push(slot);
|
||||||
pipe = slot.pipe(send);
|
pipe = slot.then(send);
|
||||||
} else {
|
} else {
|
||||||
this._sequence = this._sequence.pipe(send, send);
|
this._sequence = this._sequence.then(send, send);
|
||||||
pipe = this._sequence;
|
pipe = this._sequence;
|
||||||
}
|
}
|
||||||
// Return the piped Promise object, enhanced with an abort method,
|
// Return the piped Promise object, enhanced with an abort method,
|
||||||
|
@ -958,7 +984,10 @@
|
||||||
fileSet,
|
fileSet,
|
||||||
i,
|
i,
|
||||||
j = 0;
|
j = 0;
|
||||||
if (limitSize && (!filesLength || files[0].size === undefined)) {
|
if (!filesLength) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (limitSize && files[0].size === undefined) {
|
||||||
limitSize = undefined;
|
limitSize = undefined;
|
||||||
}
|
}
|
||||||
if (!(options.singleFileUploads || limit || limitSize) ||
|
if (!(options.singleFileUploads || limit || limitSize) ||
|
||||||
|
@ -1015,12 +1044,21 @@
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
_replaceFileInput: function (input) {
|
_replaceFileInput: function (data) {
|
||||||
var inputClone = input.clone(true);
|
var input = data.fileInput,
|
||||||
|
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();
|
$('<form></form>').append(inputClone)[0].reset();
|
||||||
// Detaching allows to insert the fileInput on another form
|
// Detaching allows to insert the fileInput on another form
|
||||||
// without loosing the file input value:
|
// without loosing the file input value:
|
||||||
input.after(inputClone).detach();
|
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:
|
// Avoid memory leaks with the detached file input:
|
||||||
$.cleanData(input.unbind('remove'));
|
$.cleanData(input.unbind('remove'));
|
||||||
// Replace the original file input element in the fileInput
|
// Replace the original file input element in the fileInput
|
||||||
|
@ -1052,7 +1090,25 @@
|
||||||
// to be returned together in one set:
|
// to be returned together in one set:
|
||||||
dfd.resolve([e]);
|
dfd.resolve([e]);
|
||||||
},
|
},
|
||||||
dirReader;
|
successHandler = function (entries) {
|
||||||
|
that._handleFileTreeEntries(
|
||||||
|
entries,
|
||||||
|
path + entry.name + '/'
|
||||||
|
).done(function (files) {
|
||||||
|
dfd.resolve(files);
|
||||||
|
}).fail(errorHandler);
|
||||||
|
},
|
||||||
|
readEntries = function () {
|
||||||
|
dirReader.readEntries(function (results) {
|
||||||
|
if (!results.length) {
|
||||||
|
successHandler(entries);
|
||||||
|
} else {
|
||||||
|
entries = entries.concat(results);
|
||||||
|
readEntries();
|
||||||
|
}
|
||||||
|
}, errorHandler);
|
||||||
|
},
|
||||||
|
dirReader, entries = [];
|
||||||
path = path || '';
|
path = path || '';
|
||||||
if (entry.isFile) {
|
if (entry.isFile) {
|
||||||
if (entry._file) {
|
if (entry._file) {
|
||||||
|
@ -1067,14 +1123,7 @@
|
||||||
}
|
}
|
||||||
} else if (entry.isDirectory) {
|
} else if (entry.isDirectory) {
|
||||||
dirReader = entry.createReader();
|
dirReader = entry.createReader();
|
||||||
dirReader.readEntries(function (entries) {
|
readEntries();
|
||||||
that._handleFileTreeEntries(
|
|
||||||
entries,
|
|
||||||
path + entry.name + '/'
|
|
||||||
).done(function (files) {
|
|
||||||
dfd.resolve(files);
|
|
||||||
}).fail(errorHandler);
|
|
||||||
}, errorHandler);
|
|
||||||
} else {
|
} else {
|
||||||
// Return an empy list for file system items
|
// Return an empy list for file system items
|
||||||
// other than files or directories:
|
// other than files or directories:
|
||||||
|
@ -1090,7 +1139,7 @@
|
||||||
$.map(entries, function (entry) {
|
$.map(entries, function (entry) {
|
||||||
return that._handleFileTreeEntry(entry, path);
|
return that._handleFileTreeEntry(entry, path);
|
||||||
})
|
})
|
||||||
).pipe(function () {
|
).then(function () {
|
||||||
return Array.prototype.concat.apply(
|
return Array.prototype.concat.apply(
|
||||||
[],
|
[],
|
||||||
arguments
|
arguments
|
||||||
|
@ -1159,7 +1208,7 @@
|
||||||
return $.when.apply(
|
return $.when.apply(
|
||||||
$,
|
$,
|
||||||
$.map(fileInput, this._getSingleFileInputFiles)
|
$.map(fileInput, this._getSingleFileInputFiles)
|
||||||
).pipe(function () {
|
).then(function () {
|
||||||
return Array.prototype.concat.apply(
|
return Array.prototype.concat.apply(
|
||||||
[],
|
[],
|
||||||
arguments
|
arguments
|
||||||
|
@ -1176,7 +1225,7 @@
|
||||||
this._getFileInputFiles(data.fileInput).always(function (files) {
|
this._getFileInputFiles(data.fileInput).always(function (files) {
|
||||||
data.files = files;
|
data.files = files;
|
||||||
if (that.options.replaceFileInput) {
|
if (that.options.replaceFileInput) {
|
||||||
that._replaceFileInput(data.fileInput);
|
that._replaceFileInput(data);
|
||||||
}
|
}
|
||||||
if (that._trigger(
|
if (that._trigger(
|
||||||
'change',
|
'change',
|
||||||
|
@ -1229,24 +1278,21 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragOver: function (e) {
|
_onDragOver: getDragHandler('dragover'),
|
||||||
e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
|
|
||||||
var dataTransfer = e.dataTransfer;
|
_onDragEnter: getDragHandler('dragenter'),
|
||||||
if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 &&
|
|
||||||
this._trigger(
|
_onDragLeave: getDragHandler('dragleave'),
|
||||||
'dragover',
|
|
||||||
$.Event('dragover', {delegatedEvent: e})
|
|
||||||
) !== false) {
|
|
||||||
e.preventDefault();
|
|
||||||
dataTransfer.dropEffect = 'copy';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_initEventHandlers: function () {
|
_initEventHandlers: function () {
|
||||||
if (this._isXHRUpload(this.options)) {
|
if (this._isXHRUpload(this.options)) {
|
||||||
this._on(this.options.dropZone, {
|
this._on(this.options.dropZone, {
|
||||||
dragover: this._onDragOver,
|
dragover: this._onDragOver,
|
||||||
drop: this._onDrop
|
drop: this._onDrop,
|
||||||
|
// event.preventDefault() on dragenter is required for IE10+:
|
||||||
|
dragenter: this._onDragEnter,
|
||||||
|
// dragleave is not required, but added for completeness:
|
||||||
|
dragleave: this._onDragLeave
|
||||||
});
|
});
|
||||||
this._on(this.options.pasteZone, {
|
this._on(this.options.pasteZone, {
|
||||||
paste: this._onPaste
|
paste: this._onPaste
|
||||||
|
@ -1260,7 +1306,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
_destroyEventHandlers: function () {
|
_destroyEventHandlers: function () {
|
||||||
this._off(this.options.dropZone, 'dragover drop');
|
this._off(this.options.dropZone, 'dragenter dragleave dragover drop');
|
||||||
this._off(this.options.pasteZone, 'paste');
|
this._off(this.options.pasteZone, 'paste');
|
||||||
this._off(this.options.fileInput, 'change');
|
this._off(this.options.fileInput, 'change');
|
||||||
},
|
},
|
||||||
|
@ -1308,15 +1354,19 @@
|
||||||
_initDataAttributes: function () {
|
_initDataAttributes: function () {
|
||||||
var that = this,
|
var that = this,
|
||||||
options = this.options,
|
options = this.options,
|
||||||
clone = $(this.element[0].cloneNode(false));
|
data = this.element.data();
|
||||||
// Initialize options set via HTML5 data-attributes:
|
// Initialize options set via HTML5 data-attributes:
|
||||||
$.each(
|
$.each(
|
||||||
clone.data(),
|
this.element[0].attributes,
|
||||||
function (key, value) {
|
function (index, attr) {
|
||||||
var dataAttributeName = 'data-' +
|
var key = attr.name.toLowerCase(),
|
||||||
// Convert camelCase to hyphen-ated key:
|
value;
|
||||||
key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
if (/^data-/.test(key)) {
|
||||||
if (clone.attr(dataAttributeName)) {
|
// 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)) {
|
if (that._isRegExpOption(key, value)) {
|
||||||
value = that._getRegExp(value);
|
value = that._getRegExp(value);
|
||||||
}
|
}
|
||||||
|
@ -1401,7 +1451,8 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data.files = files;
|
data.files = files;
|
||||||
jqXHR = that._onSend(null, data).then(
|
jqXHR = that._onSend(null, data);
|
||||||
|
jqXHR.then(
|
||||||
function (result, textStatus, jqXHR) {
|
function (result, textStatus, jqXHR) {
|
||||||
dfd.resolve(result, textStatus, jqXHR);
|
dfd.resolve(result, textStatus, jqXHR);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue