summaryrefslogtreecommitdiff
path: root/static/website/bootstrap-css/bower_components/jquery/src/ajax/jsonp.js
diff options
context:
space:
mode:
authorprashantsinalkar2019-08-27 12:29:12 +0530
committerprashantsinalkar2019-08-27 12:29:12 +0530
commitb9c709823e26f5b20d3732e1788b871cdd961a03 (patch)
treea9089f56541854b48ddbda733832a153c6d53927 /static/website/bootstrap-css/bower_components/jquery/src/ajax/jsonp.js
parent50e8fc0832d81d124abd7606b15502545bf84b23 (diff)
downloadSciPy2019-b9c709823e26f5b20d3732e1788b871cdd961a03.tar.gz
SciPy2019-b9c709823e26f5b20d3732e1788b871cdd961a03.tar.bz2
SciPy2019-b9c709823e26f5b20d3732e1788b871cdd961a03.zip
added intial code for project
Diffstat (limited to 'static/website/bootstrap-css/bower_components/jquery/src/ajax/jsonp.js')
-rw-r--r--static/website/bootstrap-css/bower_components/jquery/src/ajax/jsonp.js89
1 files changed, 89 insertions, 0 deletions
diff --git a/static/website/bootstrap-css/bower_components/jquery/src/ajax/jsonp.js b/static/website/bootstrap-css/bower_components/jquery/src/ajax/jsonp.js
new file mode 100644
index 0000000..ff0d538
--- /dev/null
+++ b/static/website/bootstrap-css/bower_components/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";
+ }
+});
+
+});