Sha256: 869ecf70293309bfc1f0a01f24f9534fd5bad0657180489f2e3d33c6d2e486fb

Contents?: true

Size: 1.24 KB

Versions: 565

Compression:

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

// Bind script tag hack transport
jQuery.ajaxTransport( "script", function( s ) {
	// This transport only deals with cross domain requests
	if ( s.crossDomain ) {
		var script, callback;
		return {
			send: function( _, complete ) {
				script = jQuery("<script>").prop({
					async: true,
					charset: s.scriptCharset,
					src: s.url
				}).on(
					"load error",
					callback = function( evt ) {
						script.remove();
						callback = null;
						if ( evt ) {
							complete( evt.type === "error" ? 404 : 200, evt.type );
						}
					}
				);
				document.head.appendChild( script[ 0 ] );
			},
			abort: function() {
				if ( callback ) {
					callback();
				}
			}
		};
	}
});

});

Version data entries

565 entries across 565 versions & 41 rubygems

Version Path
radius-rails-3.1.4 app/assets/components/jquery/src/ajax/script.js
middleman-core-4.5.1 fixtures/import-app/bower_components/jquery/src/ajax/script.js
middleman-core-4.5.0 fixtures/import-app/bower_components/jquery/src/ajax/script.js
middleman-core-4.4.3 fixtures/import-app/bower_components/jquery/src/ajax/script.js
middleman-core-4.4.2 fixtures/import-app/bower_components/jquery/src/ajax/script.js
middleman-core-4.4.0 fixtures/import-app/bower_components/jquery/src/ajax/script.js
epuber-0.6.0 lib/epuber/third_party/bower/bower_components/jquery/src/ajax/script.js
middleman-core-4.3.11 fixtures/import-app/bower_components/jquery/src/ajax/script.js
middleman-core-4.3.10 fixtures/import-app/bower_components/jquery/src/ajax/script.js
middleman-core-4.3.8 fixtures/import-app/bower_components/jquery/src/ajax/script.js
middleman-core-4.3.7 fixtures/import-app/bower_components/jquery/src/ajax/script.js
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/middleman-core-4.3.3/fixtures/import-app/bower_components/jquery/src/ajax/script.js
middleman-core-4.3.6 fixtures/import-app/bower_components/jquery/src/ajax/script.js
middleman-core-4.3.5 fixtures/import-app/bower_components/jquery/src/ajax/script.js
iqvoc-4.12.1 vendor/assets/bower_components/jquery/src/ajax/script.js
middleman-core-4.3.4 fixtures/import-app/bower_components/jquery/src/ajax/script.js
epuber-0.5.7 lib/epuber/third_party/bower/bower_components/jquery/src/ajax/script.js
card-1.97.0 mod/bootstrap/vendor/bootswatch/docs/3/bower_components/jquery/src/ajax/script.js
middleman-core-4.3.3 fixtures/import-app/bower_components/jquery/src/ajax/script.js
card-1.96.8 mod/bootstrap/vendor/bootswatch/docs/3/bower_components/jquery/src/ajax/script.js