aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/blueimp/jquery-file-upload/js/cors
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-10 12:49:51 +0000
committerMario <mario@mariovavti.com>2019-11-10 14:10:03 +0100
commit580c3f4ffe9608d2beb56d418c68b3b112420e76 (patch)
tree82335d01179ac361d3f547a4b8e8c598d302e9f3 /vendor/blueimp/jquery-file-upload/js/cors
parentd22766f458a8539a40a57f3946459a9be1f21cd6 (diff)
downloadvolse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.gz
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.tar.bz2
volse-hubzilla-580c3f4ffe9608d2beb56d418c68b3b112420e76.zip
another bulk of composer updates
(cherry picked from commit 6685381fd8db507493c3d7c1793f8c05c681bbce)
Diffstat (limited to 'vendor/blueimp/jquery-file-upload/js/cors')
-rw-r--r--vendor/blueimp/jquery-file-upload/js/cors/jquery.postmessage-transport.js218
-rw-r--r--vendor/blueimp/jquery-file-upload/js/cors/jquery.xdr-transport.js154
2 files changed, 190 insertions, 182 deletions
diff --git a/vendor/blueimp/jquery-file-upload/js/cors/jquery.postmessage-transport.js b/vendor/blueimp/jquery-file-upload/js/cors/jquery.postmessage-transport.js
index 2a0c38cb6..0a3d9fe45 100644
--- a/vendor/blueimp/jquery-file-upload/js/cors/jquery.postmessage-transport.js
+++ b/vendor/blueimp/jquery-file-upload/js/cors/jquery.postmessage-transport.js
@@ -9,118 +9,118 @@
* https://opensource.org/licenses/MIT
*/
-/* global define, require, window, document */
+/* global define, require */
-;(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define(['jquery'], factory);
- } else if (typeof exports === 'object') {
- // Node/CommonJS:
- factory(require('jquery'));
- } else {
- // Browser globals:
- factory(window.jQuery);
- }
-}(function ($) {
- 'use strict';
+(function(factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define(['jquery'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(require('jquery'));
+ } else {
+ // Browser globals:
+ factory(window.jQuery);
+ }
+})(function($) {
+ 'use strict';
- var counter = 0,
- names = [
- 'accepts',
- 'cache',
- 'contents',
- 'contentType',
- 'crossDomain',
- 'data',
- 'dataType',
- 'headers',
- 'ifModified',
- 'mimeType',
- 'password',
- 'processData',
- 'timeout',
- 'traditional',
- 'type',
- 'url',
- 'username'
- ],
- convert = function (p) {
- return p;
- };
+ var counter = 0,
+ names = [
+ 'accepts',
+ 'cache',
+ 'contents',
+ 'contentType',
+ 'crossDomain',
+ 'data',
+ 'dataType',
+ 'headers',
+ 'ifModified',
+ 'mimeType',
+ 'password',
+ 'processData',
+ 'timeout',
+ 'traditional',
+ 'type',
+ 'url',
+ 'username'
+ ],
+ convert = function(p) {
+ return p;
+ };
- $.ajaxSetup({
- converters: {
- 'postmessage text': convert,
- 'postmessage json': convert,
- 'postmessage html': convert
- }
- });
+ $.ajaxSetup({
+ converters: {
+ 'postmessage text': convert,
+ 'postmessage json': convert,
+ 'postmessage html': convert
+ }
+ });
- $.ajaxTransport('postmessage', function (options) {
- if (options.postMessage && window.postMessage) {
- var iframe,
- loc = $('<a>').prop('href', options.postMessage)[0],
- target = loc.protocol + '//' + loc.host,
- xhrUpload = options.xhr().upload;
- // IE always includes the port for the host property of a link
- // element, but not in the location.host or origin property for the
- // default http port 80 and https port 443, so we strip it:
- if (/^(http:\/\/.+:80)|(https:\/\/.+:443)$/.test(target)) {
- target = target.replace(/:(80|443)$/, '');
- }
- return {
- send: function (_, completeCallback) {
- counter += 1;
- var message = {
- id: 'postmessage-transport-' + counter
- },
- eventName = 'message.' + message.id;
- iframe = $(
- '<iframe style="display:none;" src="' +
- options.postMessage + '" name="' +
- message.id + '"></iframe>'
- ).bind('load', function () {
- $.each(names, function (i, name) {
- message[name] = options[name];
- });
- message.dataType = message.dataType.replace('postmessage ', '');
- $(window).bind(eventName, function (e) {
- e = e.originalEvent;
- var data = e.data,
- ev;
- if (e.origin === target && data.id === message.id) {
- if (data.type === 'progress') {
- ev = document.createEvent('Event');
- ev.initEvent(data.type, false, true);
- $.extend(ev, data);
- xhrUpload.dispatchEvent(ev);
- } else {
- completeCallback(
- data.status,
- data.statusText,
- {postmessage: data.result},
- data.headers
- );
- iframe.remove();
- $(window).unbind(eventName);
- }
- }
- });
- iframe[0].contentWindow.postMessage(
- message,
- target
- );
- }).appendTo(document.body);
- },
- abort: function () {
- if (iframe) {
- iframe.remove();
- }
+ $.ajaxTransport('postmessage', function(options) {
+ if (options.postMessage && window.postMessage) {
+ var iframe,
+ loc = $('<a>').prop('href', options.postMessage)[0],
+ target = loc.protocol + '//' + loc.host,
+ xhrUpload = options.xhr().upload;
+ // IE always includes the port for the host property of a link
+ // element, but not in the location.host or origin property for the
+ // default http port 80 and https port 443, so we strip it:
+ if (/^(http:\/\/.+:80)|(https:\/\/.+:443)$/.test(target)) {
+ target = target.replace(/:(80|443)$/, '');
+ }
+ return {
+ send: function(_, completeCallback) {
+ counter += 1;
+ var message = {
+ id: 'postmessage-transport-' + counter
+ },
+ eventName = 'message.' + message.id;
+ iframe = $(
+ '<iframe style="display:none;" src="' +
+ options.postMessage +
+ '" name="' +
+ message.id +
+ '"></iframe>'
+ )
+ .bind('load', function() {
+ $.each(names, function(i, name) {
+ message[name] = options[name];
+ });
+ message.dataType = message.dataType.replace('postmessage ', '');
+ $(window).bind(eventName, function(event) {
+ var e = event.originalEvent;
+ var data = e.data;
+ var ev;
+ if (e.origin === target && data.id === message.id) {
+ if (data.type === 'progress') {
+ ev = document.createEvent('Event');
+ ev.initEvent(data.type, false, true);
+ $.extend(ev, data);
+ xhrUpload.dispatchEvent(ev);
+ } else {
+ completeCallback(
+ data.status,
+ data.statusText,
+ { postmessage: data.result },
+ data.headers
+ );
+ iframe.remove();
+ $(window).unbind(eventName);
+ }
}
- };
+ });
+ iframe[0].contentWindow.postMessage(message, target);
+ })
+ .appendTo(document.body);
+ },
+ abort: function() {
+ if (iframe) {
+ iframe.remove();
+ }
}
- });
-
-}));
+ };
+ }
+ });
+});
diff --git a/vendor/blueimp/jquery-file-upload/js/cors/jquery.xdr-transport.js b/vendor/blueimp/jquery-file-upload/js/cors/jquery.xdr-transport.js
index a4e2699c6..68e36be58 100644
--- a/vendor/blueimp/jquery-file-upload/js/cors/jquery.xdr-transport.js
+++ b/vendor/blueimp/jquery-file-upload/js/cors/jquery.xdr-transport.js
@@ -12,78 +12,86 @@
* https://github.com/jaubourg/ajaxHooks/
*/
-/* global define, require, window, XDomainRequest */
+/* global define, require, XDomainRequest */
-;(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define(['jquery'], factory);
- } else if (typeof exports === 'object') {
- // Node/CommonJS:
- factory(require('jquery'));
- } else {
- // Browser globals:
- factory(window.jQuery);
- }
-}(function ($) {
- 'use strict';
- if (window.XDomainRequest && !$.support.cors) {
- $.ajaxTransport(function (s) {
- if (s.crossDomain && s.async) {
- if (s.timeout) {
- s.xdrTimeout = s.timeout;
- delete s.timeout;
- }
- var xdr;
- return {
- send: function (headers, completeCallback) {
- var addParamChar = /\?/.test(s.url) ? '&' : '?';
- function callback(status, statusText, responses, responseHeaders) {
- xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;
- xdr = null;
- completeCallback(status, statusText, responses, responseHeaders);
- }
- xdr = new XDomainRequest();
- // XDomainRequest only supports GET and POST:
- if (s.type === 'DELETE') {
- s.url = s.url + addParamChar + '_method=DELETE';
- s.type = 'POST';
- } else if (s.type === 'PUT') {
- s.url = s.url + addParamChar + '_method=PUT';
- s.type = 'POST';
- } else if (s.type === 'PATCH') {
- s.url = s.url + addParamChar + '_method=PATCH';
- s.type = 'POST';
- }
- xdr.open(s.type, s.url);
- xdr.onload = function () {
- callback(
- 200,
- 'OK',
- {text: xdr.responseText},
- 'Content-Type: ' + xdr.contentType
- );
- };
- xdr.onerror = function () {
- callback(404, 'Not Found');
- };
- if (s.xdrTimeout) {
- xdr.ontimeout = function () {
- callback(0, 'timeout');
- };
- xdr.timeout = s.xdrTimeout;
- }
- xdr.send((s.hasContent && s.data) || null);
- },
- abort: function () {
- if (xdr) {
- xdr.onerror = $.noop();
- xdr.abort();
- }
- }
- };
+(function(factory) {
+ 'use strict';
+ if (typeof define === 'function' && define.amd) {
+ // Register as an anonymous AMD module:
+ define(['jquery'], factory);
+ } else if (typeof exports === 'object') {
+ // Node/CommonJS:
+ factory(require('jquery'));
+ } else {
+ // Browser globals:
+ factory(window.jQuery);
+ }
+})(function($) {
+ 'use strict';
+ if (window.XDomainRequest && !$.support.cors) {
+ $.ajaxTransport(function(s) {
+ if (s.crossDomain && s.async) {
+ if (s.timeout) {
+ s.xdrTimeout = s.timeout;
+ delete s.timeout;
+ }
+ var xdr;
+ return {
+ send: function(headers, completeCallback) {
+ var addParamChar = /\?/.test(s.url) ? '&' : '?';
+ /**
+ * Callback wrapper function
+ *
+ * @param {number} status HTTP status code
+ * @param {string} statusText HTTP status text
+ * @param {object} [responses] Content-type specific responses
+ * @param {string} [responseHeaders] Response headers string
+ */
+ function callback(status, statusText, responses, responseHeaders) {
+ xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;
+ xdr = null;
+ completeCallback(status, statusText, responses, responseHeaders);
}
- });
- }
-}));
+ xdr = new XDomainRequest();
+ // XDomainRequest only supports GET and POST:
+ if (s.type === 'DELETE') {
+ s.url = s.url + addParamChar + '_method=DELETE';
+ s.type = 'POST';
+ } else if (s.type === 'PUT') {
+ s.url = s.url + addParamChar + '_method=PUT';
+ s.type = 'POST';
+ } else if (s.type === 'PATCH') {
+ s.url = s.url + addParamChar + '_method=PATCH';
+ s.type = 'POST';
+ }
+ xdr.open(s.type, s.url);
+ xdr.onload = function() {
+ callback(
+ 200,
+ 'OK',
+ { text: xdr.responseText },
+ 'Content-Type: ' + xdr.contentType
+ );
+ };
+ xdr.onerror = function() {
+ callback(404, 'Not Found');
+ };
+ if (s.xdrTimeout) {
+ xdr.ontimeout = function() {
+ callback(0, 'timeout');
+ };
+ xdr.timeout = s.xdrTimeout;
+ }
+ xdr.send((s.hasContent && s.data) || null);
+ },
+ abort: function() {
+ if (xdr) {
+ xdr.onerror = $.noop();
+ xdr.abort();
+ }
+ }
+ };
+ }
+ });
+ }
+});