2010-12-09 18:34:28 +00:00
|
|
|
(function( jQuery ) {
|
|
|
|
|
|
|
|
// Install text to script executor
|
|
|
|
jQuery.extend( true, jQuery.ajaxSettings , {
|
|
|
|
|
|
|
|
accepts: {
|
|
|
|
script: "text/javascript, application/javascript"
|
|
|
|
},
|
|
|
|
|
|
|
|
autoDataType: {
|
|
|
|
script: /javascript/
|
|
|
|
},
|
|
|
|
|
|
|
|
dataConverters: {
|
2010-12-24 17:02:45 +00:00
|
|
|
"text script": jQuery.globalEval
|
2010-12-09 18:34:28 +00:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
|
|
|
// Bind script tag hack transport
|
2010-12-21 12:06:41 +00:00
|
|
|
jQuery.xhr.transport("script", function(s) {
|
2010-12-09 18:34:28 +00:00
|
|
|
|
|
|
|
// Handle cache special case
|
|
|
|
if ( s.cache === undefined ) {
|
|
|
|
s.cache = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This transport only deals with cross domain get requests
|
|
|
|
if ( s.crossDomain && s.async && ( s.type === "GET" || ! s.data ) ) {
|
|
|
|
|
|
|
|
s.global = false;
|
|
|
|
|
|
|
|
var script,
|
|
|
|
head = document.getElementsByTagName("head")[0] || document.documentElement;
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
send: function(_, callback) {
|
|
|
|
|
|
|
|
script = document.createElement("script");
|
|
|
|
|
|
|
|
script.async = "async";
|
|
|
|
|
|
|
|
if ( s.scriptCharset ) {
|
|
|
|
script.charset = s.scriptCharset;
|
|
|
|
}
|
|
|
|
|
|
|
|
script.src = s.url;
|
|
|
|
|
|
|
|
// Attach handlers for all browsers
|
2010-12-30 03:41:52 +00:00
|
|
|
script.onload = script.onreadystatechange = function( _ , statusText) {
|
2010-12-09 18:34:28 +00:00
|
|
|
|
2010-12-30 03:41:52 +00:00
|
|
|
if ( ! script.readyState || /loaded|complete/.test( script.readyState ) ) {
|
2010-12-09 18:34:28 +00:00
|
|
|
|
|
|
|
// Handle memory leak in IE
|
|
|
|
script.onload = script.onreadystatechange = null;
|
|
|
|
|
|
|
|
// Remove the script
|
|
|
|
if ( head && script.parentNode ) {
|
|
|
|
head.removeChild( script );
|
|
|
|
}
|
|
|
|
|
2010-12-30 03:41:52 +00:00
|
|
|
script = 0;
|
2010-12-09 18:34:28 +00:00
|
|
|
|
2010-12-30 03:41:52 +00:00
|
|
|
// Callback
|
|
|
|
callback( statusText ? 0 : 200, statusText || "success" );
|
2010-12-09 18:34:28 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
|
|
|
|
// This arises when a base node is used (#2709 and #4378).
|
|
|
|
head.insertBefore( script, head.firstChild );
|
|
|
|
},
|
|
|
|
|
|
|
|
abort: function(statusText) {
|
|
|
|
if ( script ) {
|
2010-12-30 03:41:52 +00:00
|
|
|
script.onload( 0 , statusText );
|
2010-12-09 18:34:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2010-12-10 02:14:03 +00:00
|
|
|
})( jQuery );
|