Update jQuery File Upload to version 9.5.7

pull/30/head
Francis Lachapelle 2014-03-21 13:47:40 -04:00
parent 877e44c6d2
commit 93f1540c17
3 changed files with 32 additions and 18 deletions

1
NEWS
View File

@ -5,6 +5,7 @@ Enhancements
- updated French translation - updated French translation
- added sanitization support for Outlook/ActiveSync to circumvent Outlook bugs (#2667) - added sanitization support for Outlook/ActiveSync to circumvent Outlook bugs (#2667)
- updated CKEditor to version 4.3.3 - updated CKEditor to version 4.3.3
- updated jQuery File Upload to version 9.5.7
Bug fixes Bug fixes
- fixed possible exception when retrieving the default event reminder value on 64bit architectures (#2647, #2648) - fixed possible exception when retrieving the default event reminder value on 64bit architectures (#2647, #2648)

View File

@ -1,5 +1,5 @@
/* /*
* jQuery File Upload Plugin 5.39.0 * jQuery File Upload Plugin 5.40.1
* https://github.com/blueimp/jQuery-File-Upload * https://github.com/blueimp/jQuery-File-Upload
* *
* Copyright 2010, Sebastian Tschan * Copyright 2010, Sebastian Tschan
@ -9,8 +9,8 @@
* http://www.opensource.org/licenses/MIT * http://www.opensource.org/licenses/MIT
*/ */
/*jslint nomen: true, unparam: true, regexp: true */ /* jshint nomen:false */
/*global define, window, document, location, File, Blob, FormData */ /* global define, window, document, location, Blob, FormData */
(function (factory) { (function (factory) {
'use strict'; 'use strict';
@ -419,7 +419,8 @@
file = options.files[0], file = options.files[0],
// Ignore non-multipart setting if not supported: // Ignore non-multipart setting if not supported:
multipart = options.multipart || !$.support.xhrFileUpload, multipart = options.multipart || !$.support.xhrFileUpload,
paramName = options.paramName[0]; paramName = $.type(options.paramName) === 'array' ?
options.paramName[0] : options.paramName;
options.headers = $.extend({}, options.headers); options.headers = $.extend({}, options.headers);
if (options.contentRange) { if (options.contentRange) {
options.headers['Content-Range'] = options.contentRange; options.headers['Content-Range'] = options.contentRange;
@ -429,7 +430,7 @@
encodeURI(file.name) + '"'; encodeURI(file.name) + '"';
} }
if (!multipart) { if (!multipart) {
options.contentType = file.type; options.contentType = file.type || 'application/octet-stream';
options.data = options.blob || file; options.data = options.blob || file;
} else if ($.support.xhrFormDataFileUpload) { } else if ($.support.xhrFormDataFileUpload) {
if (options.postMessage) { if (options.postMessage) {
@ -446,7 +447,8 @@
} else { } else {
$.each(options.files, function (index, file) { $.each(options.files, function (index, file) {
formData.push({ formData.push({
name: options.paramName[index] || paramName, name: ($.type(options.paramName) === 'array' &&
options.paramName[index]) || paramName,
value: file value: file
}); });
}); });
@ -469,7 +471,8 @@
if (that._isInstanceOf('File', file) || if (that._isInstanceOf('File', file) ||
that._isInstanceOf('Blob', file)) { that._isInstanceOf('Blob', file)) {
formData.append( formData.append(
options.paramName[index] || paramName, ($.type(options.paramName) === 'array' &&
options.paramName[index]) || paramName,
file, file,
file.uploadName || file.name file.uploadName || file.name
); );
@ -979,8 +982,8 @@
for (i = 0; i < filesLength; i = i + 1) { for (i = 0; i < filesLength; i = i + 1) {
batchSize += files[i].size + overhead; batchSize += files[i].size + overhead;
if (i + 1 === filesLength || if (i + 1 === filesLength ||
(batchSize + files[i + 1].size + overhead) > ((batchSize + files[i + 1].size + overhead) > limitSize) ||
limitSize) { (limit && i + 1 - j >= limit)) {
fileSet.push(files.slice(j, i + 1)); fileSet.push(files.slice(j, i + 1));
paramNameSlice = paramName.slice(j, i + 1); paramNameSlice = paramName.slice(j, i + 1);
if (!paramNameSlice.length) { if (!paramNameSlice.length) {
@ -1304,15 +1307,21 @@
_initDataAttributes: function () { _initDataAttributes: function () {
var that = this, var that = this,
options = this.options; options = this.options,
clone = $(this.element[0].cloneNode(false));
// Initialize options set via HTML5 data-attributes: // Initialize options set via HTML5 data-attributes:
$.each( $.each(
$(this.element[0].cloneNode(false)).data(), clone.data(),
function (key, value) { function (key, value) {
if (that._isRegExpOption(key, value)) { var dataAttributeName = 'data-' +
value = that._getRegExp(value); // Convert camelCase to hyphen-ated key:
key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
if (clone.attr(dataAttributeName)) {
if (that._isRegExpOption(key, value)) {
value = that._getRegExp(value);
}
options[key] = value;
} }
options[key] = value;
} }
); );
}, },

View File

@ -1,5 +1,5 @@
/* /*
* jQuery Iframe Transport Plugin 1.8.1 * jQuery Iframe Transport Plugin 1.8.2
* https://github.com/blueimp/jQuery-File-Upload * https://github.com/blueimp/jQuery-File-Upload
* *
* Copyright 2011, Sebastian Tschan * Copyright 2011, Sebastian Tschan
@ -9,8 +9,7 @@
* http://www.opensource.org/licenses/MIT * http://www.opensource.org/licenses/MIT
*/ */
/*jslint unparam: true, nomen: true */ /* global define, window, document */
/*global define, window, document */
(function (factory) { (function (factory) {
'use strict'; 'use strict';
@ -143,6 +142,8 @@
.prop('enctype', 'multipart/form-data') .prop('enctype', 'multipart/form-data')
// enctype must be set as encoding for IE: // enctype must be set as encoding for IE:
.prop('encoding', 'multipart/form-data'); .prop('encoding', 'multipart/form-data');
// Remove the HTML5 form attribute from the input(s):
options.fileInput.removeAttr('form');
} }
form.submit(); form.submit();
// Insert the file input fields at their original location // Insert the file input fields at their original location
@ -150,7 +151,10 @@
if (fileInputClones && fileInputClones.length) { if (fileInputClones && fileInputClones.length) {
options.fileInput.each(function (index, input) { options.fileInput.each(function (index, input) {
var clone = $(fileInputClones[index]); var clone = $(fileInputClones[index]);
$(input).prop('name', clone.prop('name')); // Restore the original name and form properties:
$(input)
.prop('name', clone.prop('name'))
.attr('form', clone.attr('form'));
clone.replaceWith(input); clone.replaceWith(input);
}); });
} }