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
iqvoc-4.11.0 vendor/assets/bower_components/jquery/src/ajax/script.js
kms-0.8.0 vendor/assets/bower_components/jquery/src/ajax/script.js
abstracted-0.4.17 vendor/assets/components/jquery/src/ajax/script.js
abstracted-0.4.16 vendor/assets/components/jquery/src/ajax/script.js
abstracted-0.4.15 vendor/assets/components/jquery/src/ajax/script.js
abstracted-0.4.14 vendor/assets/components/jquery/src/ajax/script.js
TokiCLI-0.3.1 lib/TokiServer/bower_components/jquery/src/ajax/script.js
middleman-core-4.2.1 fixtures/import-app/bower_components/jquery/src/ajax/script.js
trusty-festivity-extension-2.6.3 vendor/assets/components/jquery/src/ajax/script.js
trusty-festivity-extension-2.6.2 vendor/assets/components/jquery/src/ajax/script.js
unpoly-rails-0.32.0 spec_app/vendor/assets/bower_components/jquery/src/ajax/script.js
kms-0.7.0 vendor/assets/bower_components/jquery/src/ajax/script.js
middleman-core-4.2.0 fixtures/import-app/bower_components/jquery/src/ajax/script.js
trusty-festivity-extension-2.6.1 vendor/assets/components/jquery/src/ajax/script.js
middleman-core-4.1.14 fixtures/import-app/bower_components/jquery/src/ajax/script.js
middleman-core-4.1.13 fixtures/import-app/bower_components/jquery/src/ajax/script.js
trusty-festivity-extension-2.6 vendor/assets/components/jquery/src/ajax/script.js
active_record_survey_api-0.0.19 spec/test_app/vendor/assets/bower_components/jquery/src/ajax/script.js
active_record_survey_api-0.0.18 spec/test_app/vendor/assets/bower_components/jquery/src/ajax/script.js
middleman-core-4.1.12 fixtures/import-app/bower_components/jquery/src/ajax/script.js