scratch – Diff between revs 58 and 125

Subversion Repositories:
Rev:
Show entire fileRegard whitespace
Rev 58 Rev 125
Line 3... Line 3...
3 "./var/nonce", 3 "./var/nonce",
4 "./var/rquery", 4 "./var/rquery",
5 "../ajax" 5 "../ajax"
6 ], function( jQuery, nonce, rquery ) { 6 ], function( jQuery, nonce, rquery ) {
Line 7... Line -...
7   -  
8 "use strict"; -  
9   7  
10 var oldCallbacks = [], 8 var oldCallbacks = [],
Line 11... Line 9...
11 rjsonp = /(=)\?(?=&|$)|\?\?/; 9 rjsonp = /(=)\?(?=&|$)|\?\?/;
12   10  
Line 24... Line 22...
24 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 22 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
Line 25... Line 23...
25   23  
26 var callbackName, overwritten, responseContainer, 24 var callbackName, overwritten, responseContainer,
27 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 25 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
28 "url" : -  
29 typeof s.data === "string" && -  
30 ( s.contentType || "" ) 26 "url" :
31 .indexOf( "application/x-www-form-urlencoded" ) === 0 && -  
32 rjsonp.test( s.data ) && "data" 27 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
Line 33... Line 28...
33 ); 28 );
34   29  
Line 53... Line 48...
53 jQuery.error( callbackName + " was not called" ); 48 jQuery.error( callbackName + " was not called" );
54 } 49 }
55 return responseContainer[ 0 ]; 50 return responseContainer[ 0 ];
56 }; 51 };
Line 57... Line 52...
57   52  
58 // Force json dataType 53 // force json dataType
Line 59... Line 54...
59 s.dataTypes[ 0 ] = "json"; 54 s.dataTypes[ 0 ] = "json";
60   55  
61 // Install callback 56 // Install callback
62 overwritten = window[ callbackName ]; 57 overwritten = window[ callbackName ];
63 window[ callbackName ] = function() { 58 window[ callbackName ] = function() {
Line 64... Line 59...
64 responseContainer = arguments; 59 responseContainer = arguments;
65 }; 60 };
66   -  
67 // Clean-up function (fires after converters) -  
68 jqXHR.always( function() { -  
69   -  
70 // If previous value didn't exist - remove it -  
71 if ( overwritten === undefined ) { 61  
72 jQuery( window ).removeProp( callbackName ); -  
73   62 // Clean-up function (fires after converters)
74 // Otherwise restore preexisting value -  
Line 75... Line 63...
75 } else { 63 jqXHR.always(function() {
76 window[ callbackName ] = overwritten; 64 // Restore preexisting value
77 } -  
78   65 window[ callbackName ] = overwritten;
79 // Save back as free 66  
Line 80... Line 67...
80 if ( s[ callbackName ] ) { 67 // Save back as free
81   68 if ( s[ callbackName ] ) {
82 // Make sure that re-using the options doesn't screw things around 69 // make sure that re-using the options doesn't screw things around
Line 83... Line 70...
83 s.jsonpCallback = originalSettings.jsonpCallback; 70 s.jsonpCallback = originalSettings.jsonpCallback;
84   71