DEV: Update jquery.fileupload and dependencies (#9466)

This commit is contained in:
Penar Musaraj
2020-04-28 10:39:29 -04:00
committed by GitHub
parent 4b57eb7049
commit ec2943c5bc
6 changed files with 2541 additions and 2130 deletions

View File

@ -61,6 +61,12 @@ task 'javascript:update' do
source: 'jquery-color/dist/jquery.color.js' source: 'jquery-color/dist/jquery.color.js'
}, { }, {
source: 'jquery.cookie/jquery.cookie.js' source: 'jquery.cookie/jquery.cookie.js'
}, {
source: 'blueimp-file-upload/js/jquery.fileupload.js',
}, {
source: 'blueimp-file-upload/js/jquery.iframe-transport.js',
}, {
source: 'blueimp-file-upload/js/vendor/jquery.ui.widget.js',
}, { }, {
source: 'jquery/dist/jquery.js' source: 'jquery/dist/jquery.js'
}, { }, {

View File

@ -9,6 +9,7 @@
"@fortawesome/fontawesome-free": "5.11.2", "@fortawesome/fontawesome-free": "5.11.2",
"@popperjs/core": "v2.0.6", "@popperjs/core": "v2.0.6",
"ace-builds": "1.4.2", "ace-builds": "1.4.2",
"blueimp-file-upload": "10.13.0",
"bootbox": "3.2.0", "bootbox": "3.2.0",
"bootstrap": "v3.4.1", "bootstrap": "v3.4.1",
"chart.js": "2.9.3", "chart.js": "2.9.3",

File diff suppressed because it is too large Load Diff

View File

@ -1,217 +1,221 @@
/* /*
* jQuery Iframe Transport Plugin 1.8.3 * jQuery Iframe Transport Plugin
* https://github.com/blueimp/jQuery-File-Upload * https://github.com/blueimp/jQuery-File-Upload
* *
* Copyright 2011, Sebastian Tschan * Copyright 2011, Sebastian Tschan
* https://blueimp.net * https://blueimp.net
* *
* Licensed under the MIT license: * Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT * https://opensource.org/licenses/MIT
*/ */
/* global define, require, window, document */ /* global define, require */
(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:
define(['jquery'], factory); define(['jquery'], factory);
} else if (typeof exports === 'object') { } else if (typeof exports === 'object') {
// Node/CommonJS: // Node/CommonJS:
factory(require('jquery')); factory(require('jquery'));
} else { } else {
// Browser globals: // Browser globals:
factory(window.jQuery); factory(window.jQuery);
} }
}(function ($) { })(function ($) {
'use strict'; 'use strict';
// Helper variable to create unique names for the transport iframes: // Helper variable to create unique names for the transport iframes:
var counter = 0; var counter = 0,
jsonAPI = $,
jsonParse = 'parseJSON';
// The iframe transport accepts four additional options: if ('JSON' in window && 'parse' in JSON) {
// options.fileInput: a jQuery collection of file input fields jsonAPI = JSON;
// options.paramName: the parameter name for the file form data, jsonParse = 'parse';
// overrides the name property of the file input field(s), }
// can be a string or an array of strings.
// options.formData: an array of objects with name and value properties, // The iframe transport accepts four additional options:
// equivalent to the return data of .serializeArray(), e.g.: // options.fileInput: a jQuery collection of file input fields
// [{name: 'a', value: 1}, {name: 'b', value: 2}] // options.paramName: the parameter name for the file form data,
// options.initialIframeSrc: the URL of the initial iframe src, // overrides the name property of the file input field(s),
// by default set to "javascript:false;" // can be a string or an array of strings.
$.ajaxTransport('iframe', function (options) { // options.formData: an array of objects with name and value properties,
if (options.async) { // equivalent to the return data of .serializeArray(), e.g.:
// javascript:false as initial iframe src // [{name: 'a', value: 1}, {name: 'b', value: 2}]
// prevents warning popups on HTTPS in IE6: // options.initialIframeSrc: the URL of the initial iframe src,
/*jshint scripturl: true */ // by default set to "javascript:false;"
var initialIframeSrc = options.initialIframeSrc || 'javascript:false;', $.ajaxTransport('iframe', function (options) {
/*jshint scripturl: false */ if (options.async) {
form, // javascript:false as initial iframe src
iframe, // prevents warning popups on HTTPS in IE6:
addParamChar; // eslint-disable-next-line no-script-url
return { var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
send: function (_, completeCallback) { form,
form = $('<form style="display:none;"></form>'); iframe,
form.attr('accept-charset', options.formAcceptCharset); addParamChar;
addParamChar = /\?/.test(options.url) ? '&' : '?'; return {
// XDomainRequest only supports GET and POST: send: function (_, completeCallback) {
if (options.type === 'DELETE') { form = $('<form style="display:none;"></form>');
options.url = options.url + addParamChar + '_method=DELETE'; form.attr('accept-charset', options.formAcceptCharset);
options.type = 'POST'; addParamChar = /\?/.test(options.url) ? '&' : '?';
} else if (options.type === 'PUT') { // XDomainRequest only supports GET and POST:
options.url = options.url + addParamChar + '_method=PUT'; if (options.type === 'DELETE') {
options.type = 'POST'; options.url = options.url + addParamChar + '_method=DELETE';
} else if (options.type === 'PATCH') { options.type = 'POST';
options.url = options.url + addParamChar + '_method=PATCH'; } else if (options.type === 'PUT') {
options.type = 'POST'; options.url = options.url + addParamChar + '_method=PUT';
} options.type = 'POST';
// IE versions below IE8 cannot set the name property of } else if (options.type === 'PATCH') {
// elements that have already been added to the DOM, options.url = options.url + addParamChar + '_method=PATCH';
// so we set the name along with the iframe HTML markup: options.type = 'POST';
counter += 1; }
iframe = $( // IE versions below IE8 cannot set the name property of
'<iframe src="' + initialIframeSrc + // elements that have already been added to the DOM,
'" name="iframe-transport-' + counter + '"></iframe>' // so we set the name along with the iframe HTML markup:
).bind('load', function () { counter += 1;
var fileInputClones, iframe = $(
paramNames = $.isArray(options.paramName) ? '<iframe src="' +
options.paramName : [options.paramName]; initialIframeSrc +
iframe '" name="iframe-transport-' +
.unbind('load') counter +
.bind('load', function () { '"></iframe>'
var response; ).on('load', function () {
// Wrap in a try/catch block to catch exceptions thrown var fileInputClones,
// when trying to access cross-domain iframe contents: paramNames = $.isArray(options.paramName)
try { ? options.paramName
response = iframe.contents(); : [options.paramName];
// Google Chrome and Firefox do not throw an iframe.off('load').on('load', function () {
// exception when calling iframe.contents() on var response;
// cross-domain requests, so we unify the response: // Wrap in a try/catch block to catch exceptions thrown
if (!response.length || !response[0].firstChild) { // when trying to access cross-domain iframe contents:
throw new Error(); try {
} response = iframe.contents();
} catch (e) { // Google Chrome and Firefox do not throw an
response = undefined; // exception when calling iframe.contents() on
} // cross-domain requests, so we unify the response:
// The complete callback returns the if (!response.length || !response[0].firstChild) {
// iframe content document as response object: throw new Error();
completeCallback(
200,
'success',
{'iframe': response}
);
// Fix for IE endless progress bar activity bug
// (happens on form submits to iframe targets):
$('<iframe src="' + initialIframeSrc + '"></iframe>')
.appendTo(form);
window.setTimeout(function () {
// Removing the form in a setTimeout call
// allows Chrome's developer tools to display
// the response result
form.remove();
}, 0);
});
form
.prop('target', iframe.prop('name'))
.prop('action', options.url)
.prop('method', options.type);
if (options.formData) {
$.each(options.formData, function (index, field) {
$('<input type="hidden"/>')
.prop('name', field.name)
.val(field.value)
.appendTo(form);
});
}
if (options.fileInput && options.fileInput.length &&
options.type === 'POST') {
fileInputClones = options.fileInput.clone();
// Insert a clone for each file input field:
options.fileInput.after(function (index) {
return fileInputClones[index];
});
if (options.paramName) {
options.fileInput.each(function (index) {
$(this).prop(
'name',
paramNames[index] || options.paramName
);
});
}
// Appending the file input fields to the hidden form
// removes them from their original location:
form
.append(options.fileInput)
.prop('enctype', 'multipart/form-data')
// enctype must be set as encoding for IE:
.prop('encoding', 'multipart/form-data');
// Remove the HTML5 form attribute from the input(s):
options.fileInput.removeAttr('form');
}
form.submit();
// Insert the file input fields at their original location
// by replacing the clones with the originals:
if (fileInputClones && fileInputClones.length) {
options.fileInput.each(function (index, input) {
var clone = $(fileInputClones[index]);
// Restore the original name and form properties:
$(input)
.prop('name', clone.prop('name'))
.attr('form', clone.attr('form'));
clone.replaceWith(input);
});
}
});
form.append(iframe).appendTo(document.body);
},
abort: function () {
if (iframe) {
// javascript:false as iframe src aborts the request
// and prevents warning popups on HTTPS in IE6.
// concat is used to avoid the "Script URL" JSLint error:
iframe
.unbind('load')
.prop('src', initialIframeSrc);
}
if (form) {
form.remove();
}
} }
}; } catch (e) {
} response = undefined;
}); }
// The complete callback returns the
// The iframe transport returns the iframe content document as response. // iframe content document as response object:
// The following adds converters from iframe to text, json, html, xml completeCallback(200, 'success', { iframe: response });
// and script. // Fix for IE endless progress bar activity bug
// Please note that the Content-Type for JSON responses has to be text/plain // (happens on form submits to iframe targets):
// or text/html, if the browser doesn't include application/json in the $('<iframe src="' + initialIframeSrc + '"></iframe>').appendTo(
// Accept header, else IE will show a download dialog. form
// The Content-Type for XML responses on the other hand has to be always );
// application/xml or text/xml, so IE properly parses the XML response. window.setTimeout(function () {
// See also // Removing the form in a setTimeout call
// https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation // allows Chrome's developer tools to display
$.ajaxSetup({ // the response result
converters: { form.remove();
'iframe text': function (iframe) { }, 0);
return iframe && $(iframe[0].body).text(); });
}, form
'iframe json': function (iframe) { .prop('target', iframe.prop('name'))
return iframe && $.parseJSON($(iframe[0].body).text()); .prop('action', options.url)
}, .prop('method', options.type);
'iframe html': function (iframe) { if (options.formData) {
return iframe && $(iframe[0].body).html(); $.each(options.formData, function (index, field) {
}, $('<input type="hidden"/>')
'iframe xml': function (iframe) { .prop('name', field.name)
var xmlDoc = iframe && iframe[0]; .val(field.value)
return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc : .appendTo(form);
$.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) || });
$(xmlDoc.body).html());
},
'iframe script': function (iframe) {
return iframe && $.globalEval($(iframe[0].body).text());
} }
if (
options.fileInput &&
options.fileInput.length &&
options.type === 'POST'
) {
fileInputClones = options.fileInput.clone();
// Insert a clone for each file input field:
options.fileInput.after(function (index) {
return fileInputClones[index];
});
if (options.paramName) {
options.fileInput.each(function (index) {
$(this).prop('name', paramNames[index] || options.paramName);
});
}
// Appending the file input fields to the hidden form
// removes them from their original location:
form
.append(options.fileInput)
.prop('enctype', 'multipart/form-data')
// enctype must be set as encoding for IE:
.prop('encoding', 'multipart/form-data');
// Remove the HTML5 form attribute from the input(s):
options.fileInput.removeAttr('form');
}
form.submit();
// Insert the file input fields at their original location
// by replacing the clones with the originals:
if (fileInputClones && fileInputClones.length) {
options.fileInput.each(function (index, input) {
var clone = $(fileInputClones[index]);
// Restore the original name and form properties:
$(input)
.prop('name', clone.prop('name'))
.attr('form', clone.attr('form'));
clone.replaceWith(input);
});
}
});
form.append(iframe).appendTo(document.body);
},
abort: function () {
if (iframe) {
// javascript:false as iframe src aborts the request
// and prevents warning popups on HTTPS in IE6.
iframe.off('load').prop('src', initialIframeSrc);
}
if (form) {
form.remove();
}
} }
}); };
}
});
})); // The iframe transport returns the iframe content document as response.
// The following adds converters from iframe to text, json, html, xml
// and script.
// Please note that the Content-Type for JSON responses has to be text/plain
// or text/html, if the browser doesn't include application/json in the
// Accept header, else IE will show a download dialog.
// The Content-Type for XML responses on the other hand has to be always
// application/xml or text/xml, so IE properly parses the XML response.
// See also
// https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
$.ajaxSetup({
converters: {
'iframe text': function (iframe) {
return iframe && $(iframe[0].body).text();
},
'iframe json': function (iframe) {
return iframe && jsonAPI[jsonParse]($(iframe[0].body).text());
},
'iframe html': function (iframe) {
return iframe && $(iframe[0].body).html();
},
'iframe xml': function (iframe) {
var xmlDoc = iframe && iframe[0];
return xmlDoc && $.isXMLDoc(xmlDoc)
? xmlDoc
: $.parseXML(
(xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
$(xmlDoc.body).html()
);
},
'iframe script': function (iframe) {
return iframe && $.globalEval($(iframe[0].body).text());
}
}
});
});

File diff suppressed because it is too large Load Diff

View File

@ -415,6 +415,30 @@ base@^0.11.1:
mixin-deep "^1.2.0" mixin-deep "^1.2.0"
pascalcase "^0.1.1" pascalcase "^0.1.1"
blueimp-canvas-to-blob@3:
version "3.19.0"
resolved "https://registry.yarnpkg.com/blueimp-canvas-to-blob/-/blueimp-canvas-to-blob-3.19.0.tgz#842a30605c59ec12b1219bb3d8969160e27b6f8e"
integrity sha512-WlLp3GOEdpyQr5hqyPaRoFHGdzMcf6T5Wr8ZjjGl1MM4tit6+rCsJcw7psXFvgoIk69uCGEhyvZOWXU2b4bDcQ==
blueimp-file-upload@10.13.0:
version "10.13.0"
resolved "https://registry.yarnpkg.com/blueimp-file-upload/-/blueimp-file-upload-10.13.0.tgz#3994d1606caa44197e4aa29d7f7e1cdd6f521568"
integrity sha512-N0yIt/5oR0ZioBaj6u8YuCRSp+1doaJOnNJHIYHBHZdrcWfjfc9Xq03nzodkSdbQIRfWwNin5rexUwY203V35g==
optionalDependencies:
blueimp-canvas-to-blob "3"
blueimp-load-image "3"
blueimp-tmpl "3"
blueimp-load-image@3:
version "3.0.0"
resolved "https://registry.yarnpkg.com/blueimp-load-image/-/blueimp-load-image-3.0.0.tgz#d71c39440a7d2f1a83e3e86a625e329116a51705"
integrity sha512-Q9rFbd4ZUNvzSFmRXx9MoG0RwWwJeMjjEUbG7WIOJgUg22Jgkow0wL5b35B6qwiBscxACW9OHdrP5s2vQ3x8DQ==
blueimp-tmpl@3:
version "3.14.0"
resolved "https://registry.yarnpkg.com/blueimp-tmpl/-/blueimp-tmpl-3.14.0.tgz#4951cf03a127521fa88922db616949d75cbbd5c3"
integrity sha512-mA8iwfEVkvpjtBXpRp25DxGqW2YOZqC9FVLLOa03Qwdsd6J4kVyL1noC04arAm0CNsu3Y0FmxkAOt+x2MoxpYA==
bootbox@3.2.0: bootbox@3.2.0:
version "3.2.0" version "3.2.0"
resolved "https://registry.yarnpkg.com/bootbox/-/bootbox-3.2.0.tgz#00bf643fc9edefd9ae1e7c648c6b022db4be0aee" resolved "https://registry.yarnpkg.com/bootbox/-/bootbox-3.2.0.tgz#00bf643fc9edefd9ae1e7c648c6b022db4be0aee"