Skip to content

Commit 97708d3

Browse files
committed
update javascripts to latest
1 parent f0efe6a commit 97708d3

File tree

5 files changed

+168
-121
lines changed

5 files changed

+168
-121
lines changed

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

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload User Interface Plugin 6.8.2
2+
* jQuery File Upload User Interface Plugin 6.9.3
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -128,9 +128,10 @@
128128
.find('.progress').addClass(
129129
!$.support.transition && 'progress-animated'
130130
)
131+
.attr('aria-valuenow', 100)
131132
.find('.bar').css(
132133
'width',
133-
parseInt(100, 10) + '%'
134+
'100%'
134135
);
135136
}
136137
return that._trigger('sent', e, data);
@@ -150,7 +151,6 @@
150151
function () {
151152
var node = $(this);
152153
template = that._renderDownload([file])
153-
.css('height', node.height())
154154
.replaceAll(node);
155155
that._forceReflow(template);
156156
that._transition(template).done(
@@ -227,26 +227,34 @@
227227
// Callback for upload progress events:
228228
progress: function (e, data) {
229229
if (data.context) {
230-
data.context.find('.bar').css(
231-
'width',
232-
parseInt(data.loaded / data.total * 100, 10) + '%'
233-
);
230+
var progress = parseInt(data.loaded / data.total * 100, 10);
231+
data.context.find('.progress')
232+
.attr('aria-valuenow', progress)
233+
.find('.bar').css(
234+
'width',
235+
progress + '%'
236+
);
234237
}
235238
},
236239
// Callback for global upload progress events:
237240
progressall: function (e, data) {
238-
var $this = $(this);
239-
$this.find('.fileupload-progress')
241+
var $this = $(this),
242+
progress = parseInt(data.loaded / data.total * 100, 10),
243+
globalProgressNode = $this.find('.fileupload-progress'),
244+
extendedProgressNode = globalProgressNode
245+
.find('.progress-extended');
246+
if (extendedProgressNode.length) {
247+
extendedProgressNode.html(
248+
$this.data('fileupload')._renderExtendedProgress(data)
249+
);
250+
}
251+
globalProgressNode
252+
.find('.progress')
253+
.attr('aria-valuenow', progress)
240254
.find('.bar').css(
241255
'width',
242-
parseInt(data.loaded / data.total * 100, 10) + '%'
243-
).end()
244-
.find('.progress-extended').each(function () {
245-
$(this).html(
246-
$this.data('fileupload')
247-
._renderExtendedProgress(data)
248-
);
249-
});
256+
progress + '%'
257+
);
250258
},
251259
// Callback for uploads start, equivalent to the global ajaxStart event:
252260
start: function (e) {
@@ -262,7 +270,9 @@
262270
var that = $(this).data('fileupload');
263271
that._transition($(this).find('.fileupload-progress')).done(
264272
function () {
265-
$(this).find('.bar').css('width', '0%');
273+
$(this).find('.progress')
274+
.attr('aria-valuenow', '0')
275+
.find('.bar').css('width', '0%');
266276
$(this).find('.progress-extended').html(' ');
267277
that._trigger('stopped', e);
268278
}
@@ -519,8 +529,8 @@
519529
},
520530

521531
_forceReflow: function (node) {
522-
this._reflow = $.support.transition &&
523-
node.length && node[0].offsetWidth;
532+
return $.support.transition && node.length &&
533+
node[0].offsetWidth;
524534
},
525535

526536
_transition: function (node) {
@@ -653,10 +663,32 @@
653663
}
654664
},
655665

666+
_stringToRegExp: function (str) {
667+
var parts = str.split('/'),
668+
modifiers = parts.pop();
669+
parts.shift();
670+
return new RegExp(parts.join('/'), modifiers);
671+
},
672+
673+
_initRegExpOptions: function () {
674+
var options = this.options;
675+
if ($.type(options.acceptFileTypes) === 'string') {
676+
options.acceptFileTypes = this._stringToRegExp(
677+
options.acceptFileTypes
678+
);
679+
}
680+
if ($.type(options.previewSourceFileTypes) === 'string') {
681+
options.previewSourceFileTypes = this._stringToRegExp(
682+
options.previewSourceFileTypes
683+
);
684+
}
685+
},
686+
656687
_initSpecialOptions: function () {
657688
parentWidget.prototype._initSpecialOptions.call(this);
658689
this._initFilesContainer();
659690
this._initTemplates();
691+
this._initRegExpOptions();
660692
},
661693

662694
_create: function () {

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

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload Plugin 5.11.2
2+
* jQuery File Upload Plugin 5.13
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -210,10 +210,10 @@
210210
if (typeof options.formData === 'function') {
211211
return options.formData(options.form);
212212
}
213-
if ($.isArray(options.formData)) {
213+
if ($.isArray(options.formData)) {
214214
return options.formData;
215215
}
216-
if (options.formData) {
216+
if (options.formData) {
217217
formData = [];
218218
$.each(options.formData, function (name, value) {
219219
formData.push({name: name, value: value});
@@ -530,6 +530,10 @@
530530
ub + i * mcs,
531531
ub + (i + 1) * mcs
532532
);
533+
// Expose the chunk index:
534+
o.chunkIndex = i;
535+
// Expose the number of chunks:
536+
o.chunksNumber = n;
533537
// Store the current chunk size, as the blob itself
534538
// will be dereferenced after data processing:
535539
o.chunkSize = o.blob.size;
@@ -776,19 +780,30 @@
776780
}
777781
},
778782

783+
_getFileInputFiles: function (fileInput) {
784+
fileInput = $(fileInput);
785+
var files = $.each($.makeArray(fileInput.prop('files')), this._normalizeFile),
786+
value;
787+
if (!files.length) {
788+
value = fileInput.prop('value');
789+
if (!value) {
790+
return [];
791+
}
792+
// If the files property is not available, the browser does not
793+
// support the File API and we add a pseudo File object with
794+
// the input value as name with path information removed:
795+
files = [{name: value.replace(/^.*\\/, '')}];
796+
}
797+
return files;
798+
},
799+
779800
_onChange: function (e) {
780801
var that = e.data.fileupload,
781802
data = {
782-
files: $.each($.makeArray(e.target.files), that._normalizeFile),
783803
fileInput: $(e.target),
784804
form: $(e.target.form)
785805
};
786-
if (!data.files.length) {
787-
// If the files property is not available, the browser does not
788-
// support the File API and we add a pseudo File object with
789-
// the input value as name with path information removed:
790-
data.files = [{name: e.target.value.replace(/^.*\\/, '')}];
791-
}
806+
data.files = that._getFileInputFiles(data.fileInput);
792807
if (that.options.replaceFileInput) {
793808
that._replaceFileInput(data.fileInput);
794809
}
@@ -838,7 +853,7 @@
838853
return false;
839854
}
840855
if (dataTransfer) {
841-
dataTransfer.dropEffect = dataTransfer.effectAllowed = 'copy';
856+
dataTransfer.dropEffect = 'copy';
842857
}
843858
e.preventDefault();
844859
},
@@ -925,7 +940,11 @@
925940
if (!data || this.options.disabled) {
926941
return;
927942
}
928-
data.files = $.each($.makeArray(data.files), this._normalizeFile);
943+
if (data.fileInput && !data.files) {
944+
data.files = this._getFileInputFiles(data.fileInput);
945+
} else {
946+
data.files = $.each($.makeArray(data.files), this._normalizeFile);
947+
}
929948
this._onAdd(null, data);
930949
},
931950

@@ -936,7 +955,11 @@
936955
// The method returns a Promise object for the file upload call.
937956
send: function (data) {
938957
if (data && !this.options.disabled) {
939-
data.files = $.each($.makeArray(data.files), this._normalizeFile);
958+
if (data.fileInput && !data.files) {
959+
data.files = this._getFileInputFiles(data.fileInput);
960+
} else {
961+
data.files = $.each($.makeArray(data.files), this._normalizeFile);
962+
}
940963
if (data.files.length) {
941964
return this._onSend(null, data);
942965
}
Lines changed: 46 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* JavaScript Canvas to Blob 1.0.1
2+
* JavaScript Canvas to Blob 2.0.1
33
* https://github.com/blueimp/JavaScript-Canvas-to-Blob
44
*
55
* Copyright 2012, Sebastian Tschan
@@ -15,71 +15,56 @@
1515
/*jslint nomen: true, regexp: true */
1616
/*global window, atob, ArrayBuffer, Uint8Array, define */
1717

18-
(function ($) {
18+
(function (window) {
1919
'use strict';
20-
21-
var BlobBuilder = window.MozBlobBuilder ||
22-
window.WebKitBlobBuilder || window.BlobBuilder,
23-
blobTypes = /^image\/(jpeg|png)$/,
24-
25-
// Converts a canvas element to a Blob or File object:
26-
canvasToBlob = function (canvas, callback, options) {
27-
options = options || {};
28-
if (canvas.toBlob) {
29-
canvas.toBlob(callback, options.type);
30-
return true;
31-
} else if (canvas.mozGetAsFile) {
32-
var name = options.name;
33-
callback(canvas.mozGetAsFile(
34-
(blobTypes.test(options.type) && name) ||
35-
((name && name.replace(/\..+$/, '')) || 'blob') + '.png',
36-
options.type
37-
));
38-
return true;
39-
} else if (canvas.toDataURL && BlobBuilder && window.atob &&
40-
window.ArrayBuffer && window.Uint8Array) {
41-
callback(canvasToBlob.dataURItoBlob(
42-
canvas.toDataURL(options.type)
43-
));
44-
return true;
45-
}
46-
return false;
47-
};
48-
49-
// Converts a dataURI to a Blob:
50-
canvasToBlob.dataURItoBlob = function (dataURI) {
51-
var byteString,
52-
arrayBuffer,
53-
intArray,
54-
i,
55-
bb,
56-
mimeString;
57-
if (dataURI.split(',')[0].indexOf('base64') >= 0) {
58-
// Convert base64 to raw binary data held in a string:
59-
byteString = atob(dataURI.split(',')[1]);
60-
} else {
61-
// Convert base64/URLEncoded data component to raw binary data:
62-
byteString = decodeURIComponent(dataURI.split(',')[1]);
20+
var CanvasPrototype = window.HTMLCanvasElement &&
21+
window.HTMLCanvasElement.prototype,
22+
BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder ||
23+
window.MozBlobBuilder || window.MSBlobBuilder,
24+
dataURLtoBlob = BlobBuilder && window.atob && window.ArrayBuffer &&
25+
window.Uint8Array && function (dataURI) {
26+
var byteString,
27+
arrayBuffer,
28+
intArray,
29+
i,
30+
bb,
31+
mimeString;
32+
if (dataURI.split(',')[0].indexOf('base64') >= 0) {
33+
// Convert base64 to raw binary data held in a string:
34+
byteString = atob(dataURI.split(',')[1]);
35+
} else {
36+
// Convert base64/URLEncoded data component to raw binary data:
37+
byteString = decodeURIComponent(dataURI.split(',')[1]);
38+
}
39+
// Write the bytes of the string to an ArrayBuffer:
40+
arrayBuffer = new ArrayBuffer(byteString.length);
41+
intArray = new Uint8Array(arrayBuffer);
42+
for (i = 0; i < byteString.length; i += 1) {
43+
intArray[i] = byteString.charCodeAt(i);
44+
}
45+
// Write the ArrayBuffer to a blob:
46+
bb = new BlobBuilder();
47+
bb.append(arrayBuffer);
48+
// Separate out the mime component:
49+
mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
50+
return bb.getBlob(mimeString);
51+
};
52+
if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) {
53+
if (CanvasPrototype.mozGetAsFile) {
54+
CanvasPrototype.toBlob = function (callback, type) {
55+
callback(this.mozGetAsFile('blob', type));
56+
};
57+
} else if (CanvasPrototype.toDataURL && dataURLtoBlob) {
58+
CanvasPrototype.toBlob = function (callback, type) {
59+
callback(dataURLtoBlob(this.toDataURL(type)));
60+
};
6361
}
64-
// Write the bytes of the string to an ArrayBuffer:
65-
arrayBuffer = new ArrayBuffer(byteString.length);
66-
intArray = new Uint8Array(arrayBuffer);
67-
for (i = 0; i < byteString.length; i += 1) {
68-
intArray[i] = byteString.charCodeAt(i);
69-
}
70-
// Write the ArrayBuffer to a blob:
71-
bb = new BlobBuilder();
72-
bb.append(arrayBuffer);
73-
// Separate out the mime component:
74-
mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
75-
return bb.getBlob(mimeString);
76-
};
77-
62+
}
7863
if (typeof define !== 'undefined' && define.amd) {
7964
define(function () {
80-
return canvasToBlob;
65+
return dataURLtoBlob;
8166
});
8267
} else {
83-
$.canvasToBlob = canvasToBlob;
68+
window.dataURLtoBlob = dataURLtoBlob;
8469
}
8570
}(this));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* jQuery UI Widget 1.8.18+amd
2+
* jQuery UI Widget 1.8.22+amd
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
5-
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5+
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
66
* Dual licensed under the MIT or GPL Version 2 licenses.
77
* http://jquery.org/license
88
*

0 commit comments

Comments
 (0)