mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
7537bab562
commit
d84c5a7c1d
226 changed files with 51770 additions and 4157 deletions
115
dashboard-ui/bower_components/jquery/src/ajax/xhr.js
vendored
115
dashboard-ui/bower_components/jquery/src/ajax/xhr.js
vendored
|
@ -1,4 +1,4 @@
|
|||
define([
|
||||
define( [
|
||||
"../core",
|
||||
"../var/support",
|
||||
"../ajax"
|
||||
|
@ -6,47 +6,41 @@ define([
|
|||
|
||||
jQuery.ajaxSettings.xhr = function() {
|
||||
try {
|
||||
return new XMLHttpRequest();
|
||||
} catch( e ) {}
|
||||
return new window.XMLHttpRequest();
|
||||
} catch ( e ) {}
|
||||
};
|
||||
|
||||
var xhrId = 0,
|
||||
xhrCallbacks = {},
|
||||
xhrSuccessStatus = {
|
||||
// file protocol always yields status code 0, assume 200
|
||||
var xhrSuccessStatus = {
|
||||
|
||||
// File protocol always yields status code 0, assume 200
|
||||
0: 200,
|
||||
|
||||
// Support: IE9
|
||||
// #1450: sometimes IE returns 1223 when it should be 204
|
||||
1223: 204
|
||||
},
|
||||
xhrSupported = jQuery.ajaxSettings.xhr();
|
||||
|
||||
// Support: IE9
|
||||
// Open requests must be manually aborted on unload (#5280)
|
||||
// See https://support.microsoft.com/kb/2856746 for more info
|
||||
if ( window.attachEvent ) {
|
||||
window.attachEvent( "onunload", function() {
|
||||
for ( var key in xhrCallbacks ) {
|
||||
xhrCallbacks[ key ]();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
|
||||
support.ajax = xhrSupported = !!xhrSupported;
|
||||
|
||||
jQuery.ajaxTransport(function( options ) {
|
||||
var callback;
|
||||
jQuery.ajaxTransport( function( options ) {
|
||||
var callback, errorCallback;
|
||||
|
||||
// Cross domain only allowed if supported through XMLHttpRequest
|
||||
if ( support.cors || xhrSupported && !options.crossDomain ) {
|
||||
return {
|
||||
send: function( headers, complete ) {
|
||||
var i,
|
||||
xhr = options.xhr(),
|
||||
id = ++xhrId;
|
||||
xhr = options.xhr();
|
||||
|
||||
xhr.open( options.type, options.url, options.async, options.username, options.password );
|
||||
xhr.open(
|
||||
options.type,
|
||||
options.url,
|
||||
options.async,
|
||||
options.username,
|
||||
options.password
|
||||
);
|
||||
|
||||
// Apply custom fields if provided
|
||||
if ( options.xhrFields ) {
|
||||
|
@ -65,8 +59,8 @@ jQuery.ajaxTransport(function( options ) {
|
|||
// akin to a jigsaw puzzle, we simply never set it to be sure.
|
||||
// (it can always be set on a per-request basis or even using ajaxSetup)
|
||||
// For same-domain requests, won't change header if already provided.
|
||||
if ( !options.crossDomain && !headers["X-Requested-With"] ) {
|
||||
headers["X-Requested-With"] = "XMLHttpRequest";
|
||||
if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
|
||||
headers[ "X-Requested-With" ] = "XMLHttpRequest";
|
||||
}
|
||||
|
||||
// Set headers
|
||||
|
@ -78,27 +72,38 @@ jQuery.ajaxTransport(function( options ) {
|
|||
callback = function( type ) {
|
||||
return function() {
|
||||
if ( callback ) {
|
||||
delete xhrCallbacks[ id ];
|
||||
callback = xhr.onload = xhr.onerror = null;
|
||||
callback = errorCallback = xhr.onload =
|
||||
xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
|
||||
|
||||
if ( type === "abort" ) {
|
||||
xhr.abort();
|
||||
} else if ( type === "error" ) {
|
||||
complete(
|
||||
// file: protocol always yields status 0; see #8605, #14207
|
||||
xhr.status,
|
||||
xhr.statusText
|
||||
);
|
||||
|
||||
// Support: IE9
|
||||
// On a manual native abort, IE9 throws
|
||||
// errors on any property access that is not readyState
|
||||
if ( typeof xhr.status !== "number" ) {
|
||||
complete( 0, "error" );
|
||||
} else {
|
||||
complete(
|
||||
|
||||
// File: protocol always yields status 0; see #8605, #14207
|
||||
xhr.status,
|
||||
xhr.statusText
|
||||
);
|
||||
}
|
||||
} else {
|
||||
complete(
|
||||
xhrSuccessStatus[ xhr.status ] || xhr.status,
|
||||
xhr.statusText,
|
||||
// Support: IE9
|
||||
// Accessing binary-data responseText throws an exception
|
||||
// (#11426)
|
||||
typeof xhr.responseText === "string" ? {
|
||||
text: xhr.responseText
|
||||
} : undefined,
|
||||
|
||||
// Support: IE9 only
|
||||
// IE9 has no XHR2 but throws on binary (trac-11426)
|
||||
// For XHR2 non-text, let the caller handle it (gh-2498)
|
||||
( xhr.responseType || "text" ) !== "text" ||
|
||||
typeof xhr.responseText !== "string" ?
|
||||
{ binary: xhr.response } :
|
||||
{ text: xhr.responseText },
|
||||
xhr.getAllResponseHeaders()
|
||||
);
|
||||
}
|
||||
|
@ -108,15 +113,41 @@ jQuery.ajaxTransport(function( options ) {
|
|||
|
||||
// Listen to events
|
||||
xhr.onload = callback();
|
||||
xhr.onerror = callback("error");
|
||||
errorCallback = xhr.onerror = callback( "error" );
|
||||
|
||||
// Support: IE9
|
||||
// Use onreadystatechange to replace onabort
|
||||
// to handle uncaught aborts
|
||||
if ( xhr.onabort !== undefined ) {
|
||||
xhr.onabort = errorCallback;
|
||||
} else {
|
||||
xhr.onreadystatechange = function() {
|
||||
|
||||
// Check readyState before timeout as it changes
|
||||
if ( xhr.readyState === 4 ) {
|
||||
|
||||
// Allow onerror to be called first,
|
||||
// but that will not handle a native abort
|
||||
// Also, save errorCallback to a variable
|
||||
// as xhr.onerror cannot be accessed
|
||||
window.setTimeout( function() {
|
||||
if ( callback ) {
|
||||
errorCallback();
|
||||
}
|
||||
} );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Create the abort callback
|
||||
callback = xhrCallbacks[ id ] = callback("abort");
|
||||
callback = callback( "abort" );
|
||||
|
||||
try {
|
||||
|
||||
// Do send the request (this may raise an exception)
|
||||
xhr.send( options.hasContent && options.data || null );
|
||||
} catch ( e ) {
|
||||
|
||||
// #14683: Only rethrow if this hasn't been notified as an error yet
|
||||
if ( callback ) {
|
||||
throw e;
|
||||
|
@ -131,6 +162,6 @@ jQuery.ajaxTransport(function( options ) {
|
|||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
});
|
||||
} );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue