/base/000_base/node_modules/bootstrap-validator/sandbox/jquery/src/ajax/jsonp.js |
@@ -0,0 +1,89 @@ |
define([ |
"../core", |
"./var/nonce", |
"./var/rquery", |
"../ajax" |
], function( jQuery, nonce, rquery ) { |
|
var oldCallbacks = [], |
rjsonp = /(=)\?(?=&|$)|\?\?/; |
|
// Default jsonp settings |
jQuery.ajaxSetup({ |
jsonp: "callback", |
jsonpCallback: function() { |
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); |
this[ callback ] = true; |
return callback; |
} |
}); |
|
// Detect, normalize options and install callbacks for jsonp requests |
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { |
|
var callbackName, overwritten, responseContainer, |
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? |
"url" : |
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" |
); |
|
// Handle iff the expected data type is "jsonp" or we have a parameter to set |
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { |
|
// Get callback name, remembering preexisting value associated with it |
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? |
s.jsonpCallback() : |
s.jsonpCallback; |
|
// Insert callback into url or form data |
if ( jsonProp ) { |
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); |
} else if ( s.jsonp !== false ) { |
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; |
} |
|
// Use data converter to retrieve json after script execution |
s.converters["script json"] = function() { |
if ( !responseContainer ) { |
jQuery.error( callbackName + " was not called" ); |
} |
return responseContainer[ 0 ]; |
}; |
|
// force json dataType |
s.dataTypes[ 0 ] = "json"; |
|
// Install callback |
overwritten = window[ callbackName ]; |
window[ callbackName ] = function() { |
responseContainer = arguments; |
}; |
|
// Clean-up function (fires after converters) |
jqXHR.always(function() { |
// Restore preexisting value |
window[ callbackName ] = overwritten; |
|
// Save back as free |
if ( s[ callbackName ] ) { |
// make sure that re-using the options doesn't screw things around |
s.jsonpCallback = originalSettings.jsonpCallback; |
|
// save the callback name for future use |
oldCallbacks.push( callbackName ); |
} |
|
// Call if it was a function and we have a response |
if ( responseContainer && jQuery.isFunction( overwritten ) ) { |
overwritten( responseContainer[ 0 ] ); |
} |
|
responseContainer = overwritten = undefined; |
}); |
|
// Delegate to script |
return "script"; |
} |
}); |
|
}); |
/base/000_base/node_modules/bootstrap-validator/sandbox/jquery/src/ajax/load.js |
@@ -0,0 +1,75 @@ |
define([ |
"../core", |
"../core/parseHTML", |
"../ajax", |
"../traversing", |
"../manipulation", |
"../selector", |
// Optional event/alias dependency |
"../event/alias" |
], function( jQuery ) { |
|
// Keep a copy of the old load method |
var _load = jQuery.fn.load; |
|
/** |
* Load a url into a page |
*/ |
jQuery.fn.load = function( url, params, callback ) { |
if ( typeof url !== "string" && _load ) { |
return _load.apply( this, arguments ); |
} |
|
var selector, type, response, |
self = this, |
off = url.indexOf(" "); |
|
if ( off >= 0 ) { |
selector = url.slice( off ); |
url = url.slice( 0, off ); |
} |
|
// If it's a function |
if ( jQuery.isFunction( params ) ) { |
|
// We assume that it's the callback |
callback = params; |
params = undefined; |
|
// Otherwise, build a param string |
} else if ( params && typeof params === "object" ) { |
type = "POST"; |
} |
|
// If we have elements to modify, make the request |
if ( self.length > 0 ) { |
jQuery.ajax({ |
url: url, |
|
// if "type" variable is undefined, then "GET" method will be used |
type: type, |
dataType: "html", |
data: params |
}).done(function( responseText ) { |
|
// Save response for use in complete callback |
response = arguments; |
|
self.html( selector ? |
|
// If a selector was specified, locate the right elements in a dummy div |
// Exclude scripts to avoid IE 'Permission Denied' errors |
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : |
|
// Otherwise use the full result |
responseText ); |
|
}).complete( callback && function( jqXHR, status ) { |
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); |
}); |
} |
|
return this; |
}; |
|
}); |
/base/000_base/node_modules/bootstrap-validator/sandbox/jquery/src/ajax/script.js |
@@ -0,0 +1,64 @@ |
define([ |
"../core", |
"../ajax" |
], function( jQuery ) { |
|
// Install script dataType |
jQuery.ajaxSetup({ |
accepts: { |
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" |
}, |
contents: { |
script: /(?:java|ecma)script/ |
}, |
converters: { |
"text script": function( text ) { |
jQuery.globalEval( text ); |
return text; |
} |
} |
}); |
|
// Handle cache's special case and crossDomain |
jQuery.ajaxPrefilter( "script", function( s ) { |
if ( s.cache === undefined ) { |
s.cache = false; |
} |
if ( s.crossDomain ) { |
s.type = "GET"; |
} |
}); |
|
// Bind script tag hack transport |
jQuery.ajaxTransport( "script", function( s ) { |
// This transport only deals with cross domain requests |
if ( s.crossDomain ) { |
var script, callback; |
return { |
send: function( _, complete ) { |
script = jQuery("<script>").prop({ |
async: true, |
charset: s.scriptCharset, |
src: s.url |
}).on( |
"load error", |
callback = function( evt ) { |
script.remove(); |
callback = null; |
if ( evt ) { |
complete( evt.type === "error" ? 404 : 200, evt.type ); |
} |
} |
); |
document.head.appendChild( script[ 0 ] ); |
}, |
abort: function() { |
if ( callback ) { |
callback(); |
} |
} |
}; |
} |
}); |
|
}); |
/base/000_base/node_modules/bootstrap-validator/sandbox/jquery/src/ajax/xhr.js |
@@ -0,0 +1,130 @@ |
define([ |
"../core", |
"../var/support", |
"../ajax" |
], function( jQuery, support ) { |
|
jQuery.ajaxSettings.xhr = function() { |
try { |
return new XMLHttpRequest(); |
} catch( e ) {} |
}; |
|
var xhrId = 0, |
xhrCallbacks = {}, |
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) |
if ( window.ActiveXObject ) { |
jQuery( window ).on( "unload", function() { |
for ( var key in xhrCallbacks ) { |
xhrCallbacks[ key ](); |
} |
}); |
} |
|
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); |
support.ajax = xhrSupported = !!xhrSupported; |
|
jQuery.ajaxTransport(function( options ) { |
var callback; |
|
// 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.open( options.type, options.url, options.async, options.username, options.password ); |
|
// Apply custom fields if provided |
if ( options.xhrFields ) { |
for ( i in options.xhrFields ) { |
xhr[ i ] = options.xhrFields[ i ]; |
} |
} |
|
// Override mime type if needed |
if ( options.mimeType && xhr.overrideMimeType ) { |
xhr.overrideMimeType( options.mimeType ); |
} |
|
// X-Requested-With header |
// For cross-domain requests, seeing as conditions for a preflight are |
// 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"; |
} |
|
// Set headers |
for ( i in headers ) { |
xhr.setRequestHeader( i, headers[ i ] ); |
} |
|
// Callback |
callback = function( type ) { |
return function() { |
if ( callback ) { |
delete xhrCallbacks[ id ]; |
callback = xhr.onload = xhr.onerror = null; |
|
if ( type === "abort" ) { |
xhr.abort(); |
} else if ( type === "error" ) { |
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, |
xhr.getAllResponseHeaders() |
); |
} |
} |
}; |
}; |
|
// Listen to events |
xhr.onload = callback(); |
xhr.onerror = callback("error"); |
|
// Create the abort callback |
callback = xhrCallbacks[ id ] = callback("abort"); |
|
// Do send the request |
// This may raise an exception which is actually |
// handled in jQuery.ajax (so no try/catch here) |
xhr.send( options.hasContent && options.data || null ); |
}, |
|
abort: function() { |
if ( callback ) { |
callback(); |
} |
} |
}; |
} |
}); |
|
}); |