| @@ 7939-7995 (lines=57) @@ | ||
| 7936 | }); |
|
| 7937 | ||
| 7938 | // Bind script tag hack transport |
|
| 7939 | jQuery.ajaxTransport( "script", function(s) { |
|
| 7940 | ||
| 7941 | // This transport only deals with cross domain requests |
|
| 7942 | if ( s.crossDomain ) { |
|
| 7943 | ||
| 7944 | var script, |
|
| 7945 | head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; |
|
| 7946 | ||
| 7947 | return { |
|
| 7948 | ||
| 7949 | send: function( _, callback ) { |
|
| 7950 | ||
| 7951 | script = document.createElement( "script" ); |
|
| 7952 | ||
| 7953 | script.async = "async"; |
|
| 7954 | ||
| 7955 | if ( s.scriptCharset ) { |
|
| 7956 | script.charset = s.scriptCharset; |
|
| 7957 | } |
|
| 7958 | ||
| 7959 | script.src = s.url; |
|
| 7960 | ||
| 7961 | // Attach handlers for all browsers |
|
| 7962 | script.onload = script.onreadystatechange = function( _, isAbort ) { |
|
| 7963 | ||
| 7964 | if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { |
|
| 7965 | ||
| 7966 | // Handle memory leak in IE |
|
| 7967 | script.onload = script.onreadystatechange = null; |
|
| 7968 | ||
| 7969 | // Remove the script |
|
| 7970 | if ( head && script.parentNode ) { |
|
| 7971 | head.removeChild( script ); |
|
| 7972 | } |
|
| 7973 | ||
| 7974 | // Dereference the script |
|
| 7975 | script = undefined; |
|
| 7976 | ||
| 7977 | // Callback if not abort |
|
| 7978 | if ( !isAbort ) { |
|
| 7979 | callback( 200, "success" ); |
|
| 7980 | } |
|
| 7981 | } |
|
| 7982 | }; |
|
| 7983 | // Use insertBefore instead of appendChild to circumvent an IE6 bug. |
|
| 7984 | // This arises when a base node is used (#2709 and #4378). |
|
| 7985 | head.insertBefore( script, head.firstChild ); |
|
| 7986 | }, |
|
| 7987 | ||
| 7988 | abort: function() { |
|
| 7989 | if ( script ) { |
|
| 7990 | script.onload( 0, 1 ); |
|
| 7991 | } |
|
| 7992 | } |
|
| 7993 | }; |
|
| 7994 | } |
|
| 7995 | }); |
|
| 7996 | ||
| 7997 | ||
| 7998 | ||
| @@ 7009-7065 (lines=57) @@ | ||
| 7006 | } ); |
|
| 7007 | ||
| 7008 | // Bind script tag hack transport |
|
| 7009 | jQuery.ajaxTransport( "script", function(s) { |
|
| 7010 | ||
| 7011 | // This transport only deals with cross domain requests |
|
| 7012 | if ( s.crossDomain ) { |
|
| 7013 | ||
| 7014 | var script, |
|
| 7015 | head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement; |
|
| 7016 | ||
| 7017 | return { |
|
| 7018 | ||
| 7019 | send: function( _, callback ) { |
|
| 7020 | ||
| 7021 | script = document.createElement( "script" ); |
|
| 7022 | ||
| 7023 | script.async = "async"; |
|
| 7024 | ||
| 7025 | if ( s.scriptCharset ) { |
|
| 7026 | script.charset = s.scriptCharset; |
|
| 7027 | } |
|
| 7028 | ||
| 7029 | script.src = s.url; |
|
| 7030 | ||
| 7031 | // Attach handlers for all browsers |
|
| 7032 | script.onload = script.onreadystatechange = function( _, isAbort ) { |
|
| 7033 | ||
| 7034 | if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) { |
|
| 7035 | ||
| 7036 | // Handle memory leak in IE |
|
| 7037 | script.onload = script.onreadystatechange = null; |
|
| 7038 | ||
| 7039 | // Remove the script |
|
| 7040 | if ( head && script.parentNode ) { |
|
| 7041 | head.removeChild( script ); |
|
| 7042 | } |
|
| 7043 | ||
| 7044 | // Dereference the script |
|
| 7045 | script = undefined; |
|
| 7046 | ||
| 7047 | // Callback if not abort |
|
| 7048 | if ( !isAbort ) { |
|
| 7049 | callback( 200, "success" ); |
|
| 7050 | } |
|
| 7051 | } |
|
| 7052 | }; |
|
| 7053 | // Use insertBefore instead of appendChild to circumvent an IE6 bug. |
|
| 7054 | // This arises when a base node is used (#2709 and #4378). |
|
| 7055 | head.insertBefore( script, head.firstChild ); |
|
| 7056 | }, |
|
| 7057 | ||
| 7058 | abort: function() { |
|
| 7059 | if ( script ) { |
|
| 7060 | script.onload( 0, 1 ); |
|
| 7061 | } |
|
| 7062 | } |
|
| 7063 | }; |
|
| 7064 | } |
|
| 7065 | } ); |
|
| 7066 | ||
| 7067 | ||
| 7068 | ||