Sha256: 6c2ed8d38b1b242e03a064987b0dc2c9ee47d63fe68f92e3c18104e8d5b215a6

Contents?: true

Size: 1.92 KB

Versions: 6

Compression:

Stored size: 1.92 KB

Contents

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 global
jQuery.ajaxPrefilter( "script", function( s ) {
	if ( s.cache === undefined ) {
		s.cache = false;
	}
	if ( s.crossDomain ) {
		s.type = "GET";
		s.global = false;
	}
});

// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {

	// This transport only deals with cross domain requests
	if ( s.crossDomain ) {

		var script,
			head = document.head || jQuery("head")[0] || document.documentElement;

		return {

			send: function( _, callback ) {

				script = document.createElement("script");

				script.async = true;

				if ( s.scriptCharset ) {
					script.charset = s.scriptCharset;
				}

				script.src = s.url;

				// Attach handlers for all browsers
				script.onload = script.onreadystatechange = function( _, isAbort ) {

					if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {

						// Handle memory leak in IE
						script.onload = script.onreadystatechange = null;

						// Remove the script
						if ( script.parentNode ) {
							script.parentNode.removeChild( script );
						}

						// Dereference the script
						script = null;

						// Callback if not abort
						if ( !isAbort ) {
							callback( 200, "success" );
						}
					}
				};

				// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
				// Use native DOM manipulation to avoid our domManip AJAX trickery
				head.insertBefore( script, head.firstChild );
			},

			abort: function() {
				if ( script ) {
					script.onload( undefined, true );
				}
			}
		};
	}
});

});

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
rails_modular_admin-1.0.0 app/assets/node_modules/jqvmap/node_modules/jquery/src/ajax/script.js
rails_modular_admin-0.4.0 app/assets/node_modules/jqvmap/node_modules/jquery/src/ajax/script.js
simpletool-0.0.3 lib/support/phpmyadmin/phpmyadmin/js/jquery/src/jquery/ajax/script.js
simpletool-0.0.2 lib/support/phpmyadmin/phpmyadmin/js/jquery/src/jquery/ajax/script.js
kanpachi-0.0.7 lib/kanpachi/doc/template/components/jquery/src/ajax/script.js
kanpachi-0.0.6 lib/kanpachi/doc/template/components/jquery/src/ajax/script.js