Skip to content

Commit 3e5b1f0

Browse files
committed
Fetch updated js and css from upstream.
1 parent f2f77cd commit 3e5b1f0

File tree

5 files changed

+62
-29
lines changed

5 files changed

+62
-29
lines changed

fileupload/static/application.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload Plugin JS Example 5.0.1
2+
* jQuery File Upload Plugin JS Example 5.0.2
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -9,10 +9,11 @@
99
* http://creativecommons.org/licenses/MIT/
1010
*/
1111

12-
/*jslint nomen: false */
12+
/*jslint nomen: true */
1313
/*global $ */
1414

1515
$(function () {
16+
'use strict';
1617

1718
// Initialize the jQuery File Upload widget:
1819
$('#fileupload').fileupload();

fileupload/static/jquery.fileupload-ui.css

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@charset 'UTF-8';
22
/*
3-
* jQuery File Upload UI Plugin CSS 5.0.5
3+
* jQuery File Upload UI Plugin CSS 5.0.6
44
* https://github.com/blueimp/jQuery-File-Upload
55
*
66
* Copyright 2010, Sebastian Tschan
@@ -10,7 +10,7 @@
1010
* http://creativecommons.org/licenses/MIT/
1111
*/
1212

13-
.ui-button input {
13+
.fileupload-buttonbar .ui-button input {
1414
position: absolute;
1515
top: 0;
1616
right: 0;
@@ -52,16 +52,16 @@
5252
border-top-width: 0;
5353
}
5454

55-
.ui-progressbar {
55+
.fileupload-content .ui-progressbar {
5656
width: 200px;
5757
height: 20px;
5858
}
5959

60-
.ui-progressbar-value {
60+
.fileupload-content .ui-progressbar-value {
6161
background: url(pbar-ani.gif);
6262
}
6363

64-
.fileupload-progressbar {
64+
.fileupload-content .fileupload-progressbar {
6565
width: 400px;
6666
margin: 10px 0;
6767
}

fileupload/static/jquery.fileupload-ui.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload User Interface Plugin 5.0.12
2+
* jQuery File Upload User Interface Plugin 5.0.13
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -9,7 +9,7 @@
99
* http://creativecommons.org/licenses/MIT/
1010
*/
1111

12-
/*jslint nomen: false, unparam: true, regexp: false */
12+
/*jslint nomen: true, unparam: true, regexp: true */
1313
/*global window, document, URL, webkitURL, FileReader, jQuery */
1414

1515
(function ($) {

fileupload/static/jquery.fileupload.js

+23-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload Plugin 5.0.1
2+
* jQuery File Upload Plugin 5.0.3
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -9,7 +9,7 @@
99
* http://creativecommons.org/licenses/MIT/
1010
*/
1111

12-
/*jslint nomen: false, unparam: true, regexp: false */
12+
/*jslint nomen: true, unparam: true, regexp: true */
1313
/*global document, XMLHttpRequestUpload, Blob, File, FormData, location, jQuery */
1414

1515
(function ($) {
@@ -232,7 +232,7 @@
232232
options.data = options.blob;
233233
}
234234
}
235-
if (options.multipart) {
235+
if (options.multipart && typeof FormData !== 'undefined') {
236236
if (options.formData instanceof FormData) {
237237
formData = options.formData;
238238
} else {
@@ -318,14 +318,14 @@
318318

319319
// Creates and returns a Promise object enhanced with
320320
// the jqXHR methods abort, success, error and complete:
321-
_getXHRPromise: function (resolveOrReject, context) {
321+
_getXHRPromise: function (resolveOrReject, context, args) {
322322
var dfd = $.Deferred(),
323323
promise = dfd.promise();
324324
context = context || this.options.context || promise;
325325
if (resolveOrReject === true) {
326-
dfd.resolveWith(context);
326+
dfd.resolveWith(context, args);
327327
} else if (resolveOrReject === false) {
328-
dfd.rejectWith(context);
328+
dfd.rejectWith(context, args);
329329
}
330330
promise.abort = dfd.promise;
331331
return this._enhancePromise(promise);
@@ -452,11 +452,12 @@
452452
}
453453
},
454454

455-
_onAlways: function (result, textStatus, jqXHR, options) {
455+
_onAlways: function (result, textStatus, jqXHR, errorThrown, options) {
456456
this._active -= 1;
457457
options.result = result;
458458
options.textStatus = textStatus;
459459
options.jqXHR = jqXHR;
460+
options.errorThrown = errorThrown;
460461
this._trigger('always', null, options);
461462
if (this._active === 0) {
462463
// The stop callback is triggered when all uploads have
@@ -472,17 +473,22 @@
472473
jqXHR,
473474
pipe,
474475
options = that._getAJAXSettings(data),
475-
send = function () {
476-
jqXHR = ((that._trigger('send', e, options) !== false && (
477-
that._chunkedUpload(options) ||
478-
$.ajax(options)
479-
)) || that._getXHRPromise(false, options.context)
476+
send = function (resolve, args) {
477+
jqXHR = jqXHR || (
478+
(resolve !== false &&
479+
that._trigger('send', e, options) !== false &&
480+
(that._chunkedUpload(options) || $.ajax(options))) ||
481+
that._getXHRPromise(false, options.context, args)
480482
).done(function (result, textStatus, jqXHR) {
481483
that._onDone(result, textStatus, jqXHR, options);
482484
}).fail(function (jqXHR, textStatus, errorThrown) {
483485
that._onFail(jqXHR, textStatus, errorThrown, options);
484-
}).always(function (result, textStatus, jqXHR) {
485-
that._onAlways(result, textStatus, jqXHR, options);
486+
}).always(function (a1, a2, a3) {
487+
if (a3 && a3.done) {
488+
that._onAlways(a1, a2, a3, undefined, options);
489+
} else {
490+
that._onAlways(undefined, a2, a1, a3, options);
491+
}
486492
});
487493
return jqXHR;
488494
};
@@ -493,6 +499,9 @@
493499
// and jqXHR callbacks mapped to the equivalent Promise methods:
494500
pipe = (this._sequence = this._sequence.pipe(send, send));
495501
pipe.abort = function () {
502+
if (!jqXHR) {
503+
return send(false, [undefined, 'abort', 'abort']);
504+
}
496505
return jqXHR.abort();
497506
};
498507
return this._enhancePromise(pipe);

fileupload/static/jquery.iframe-transport.js

+29-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery Iframe Transport Plugin 1.1
2+
* jQuery Iframe Transport Plugin 1.2.2
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2011, Sebastian Tschan
@@ -18,11 +18,13 @@
1818
// Helper variable to create unique names for the transport iframes:
1919
var counter = 0;
2020

21-
// The iframe transport accepts two additional options:
21+
// The iframe transport accepts three additional options:
2222
// options.fileInput: a jQuery collection of file input fields
23+
// options.paramName: the parameter name for the file form data,
24+
// overrides the name property of the file input field(s)
2325
// options.formData: an array of objects with name and value properties,
24-
// equivalent to the return data of .serializeArray(), e.g.:
25-
// [{name: a, value: 1}, {name: b, value: 2}]
26+
// equivalent to the return data of .serializeArray(), e.g.:
27+
// [{name: a, value: 1}, {name: b, value: 2}]
2628
$.ajaxTransport('iframe', function (options, originalOptions, jqXHR) {
2729
if (options.type === 'POST' || options.type === 'GET') {
2830
var form,
@@ -43,12 +45,26 @@
4345
iframe
4446
.unbind('load')
4547
.bind('load', function () {
48+
var response;
49+
// Wrap in a try/catch block to catch exceptions thrown
50+
// when trying to access cross-domain iframe contents:
51+
try {
52+
response = iframe.contents();
53+
// Google Chrome and Firefox do not throw an
54+
// exception when calling iframe.contents() on
55+
// cross-domain requests, so we unify the response:
56+
if (!response.length || !response[0].firstChild) {
57+
throw new Error();
58+
}
59+
} catch (e) {
60+
response = undefined;
61+
}
4662
// The complete callback returns the
4763
// iframe content document as response object:
4864
completeCallback(
4965
200,
5066
'success',
51-
{'iframe': iframe.contents()}
67+
{'iframe': response}
5268
);
5369
// Fix for IE endless progress bar activity bug
5470
// (happens on form submits to iframe targets):
@@ -75,6 +91,11 @@
7591
options.fileInput.after(function (index) {
7692
return fileInputClones[index];
7793
});
94+
if (options.paramName) {
95+
options.fileInput.each(function () {
96+
$(this).prop('name', options.paramName);
97+
});
98+
}
7899
// Appending the file input fields to the hidden form
79100
// removes them from their original location:
80101
form
@@ -88,7 +109,9 @@
88109
// by replacing the clones with the originals:
89110
if (fileInputClones && fileInputClones.length) {
90111
options.fileInput.each(function (index, input) {
91-
$(fileInputClones[index]).replaceWith(input);
112+
var clone = $(fileInputClones[index]);
113+
$(input).prop('name', clone.prop('name'));
114+
clone.replaceWith(input);
92115
});
93116
}
94117
});

0 commit comments

Comments
 (0)