Skip to content

Commit 8620129

Browse files
committed
Update JavaScript assets.
1 parent 042d7c2 commit 8620129

File tree

4 files changed

+26
-15
lines changed

4 files changed

+26
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jquery-fileupload-rails is a library that integrates jQuery File Upload for Rail
77
## Plugin versions
88

99
* jQuery File Upload User Interface Plugin 6.9.4
10-
* jQuery File Upload Plugin 5.16.1
10+
* jQuery File Upload Plugin 5.16.3
1111
* jQuery UI Widget 1.8.23+amd
1212

1313
## Installing Gem

vendor/assets/javascripts/jquery-fileupload/jquery.fileupload.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload Plugin 5.16.1
2+
* jQuery File Upload Plugin 5.16.3
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -850,7 +850,7 @@
850850
fileInput.prop('entries'),
851851
files,
852852
value;
853-
if (entries) {
853+
if (entries && entries.length) {
854854
return this._handleFileTreeEntries(entries);
855855
}
856856
files = $.makeArray(fileInput.prop('files'));
@@ -963,8 +963,8 @@
963963
_initSpecialOptions: function () {
964964
var options = this.options;
965965
if (options.fileInput === undefined) {
966-
options.fileInput = this.element.is('input:file') ?
967-
this.element : this.element.find('input:file');
966+
options.fileInput = this.element.is('input[type="file"]') ?
967+
this.element : this.element.find('input[type="file"]');
968968
} else if (!(options.fileInput instanceof $)) {
969969
options.fileInput = $(options.fileInput);
970970
}

vendor/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* JavaScript Canvas to Blob 2.0.2
2+
* JavaScript Canvas to Blob 2.0.3
33
* https://github.com/blueimp/JavaScript-Canvas-to-Blob
44
*
55
* Copyright 2012, Sebastian Tschan
@@ -19,13 +19,21 @@
1919
'use strict';
2020
var CanvasPrototype = window.HTMLCanvasElement &&
2121
window.HTMLCanvasElement.prototype,
22-
hasBlobConstructor = function () {
22+
hasBlobConstructor = window.Blob && (function () {
23+
try {
24+
return Boolean(new Blob());
25+
} catch (e) {
26+
return false;
27+
}
28+
}()),
29+
hasArrayBufferViewSupport = hasBlobConstructor && window.Uint8Array &&
30+
(function () {
2331
try {
24-
return !!new Blob();
32+
return new Blob([new Uint8Array(100)]).size === 100;
2533
} catch (e) {
2634
return false;
2735
}
28-
}(),
36+
}()),
2937
BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder ||
3038
window.MozBlobBuilder || window.MSBlobBuilder,
3139
dataURLtoBlob = (hasBlobConstructor || BlobBuilder) && window.atob &&
@@ -34,8 +42,8 @@
3442
arrayBuffer,
3543
intArray,
3644
i,
37-
bb,
38-
mimeString;
45+
mimeString,
46+
bb;
3947
if (dataURI.split(',')[0].indexOf('base64') >= 0) {
4048
// Convert base64 to raw binary data held in a string:
4149
byteString = atob(dataURI.split(',')[1]);
@@ -51,9 +59,12 @@
5159
}
5260
// Separate out the mime component:
5361
mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
54-
// Write the ArrayBuffer to a blob:
62+
// Write the ArrayBuffer (or ArrayBufferView) to a blob:
5563
if (hasBlobConstructor) {
56-
return new Blob([arrayBuffer], {type: mimeString});
64+
return new Blob(
65+
[hasArrayBufferViewSupport ? intArray : arrayBuffer],
66+
{type: mimeString}
67+
);
5768
}
5869
bb = new BlobBuilder();
5970
bb.append(arrayBuffer);
@@ -70,7 +81,7 @@
7081
};
7182
}
7283
}
73-
if (typeof define !== 'undefined' && define.amd) {
84+
if (typeof define === 'function' && define.amd) {
7485
define(function () {
7586
return dataURLtoBlob;
7687
});

vendor/assets/javascripts/jquery-fileupload/vendor/load-image.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
return false;
112112
};
113113

114-
if (typeof define !== 'undefined' && define.amd) {
114+
if (typeof define === 'function' && define.amd) {
115115
define(function () {
116116
return loadImage;
117117
});

0 commit comments

Comments
 (0)