c5169e0e
Renato De Donato
a new hope
|
1
|
define([
|
74249687
Luigi Serra
Cross browser con...
|
2
|
"../core",
|
74249687
Luigi Serra
Cross browser con...
|
3
|
"../ajax"
|
c5169e0e
Renato De Donato
a new hope
|
4
|
], function( jQuery ) {
|
74249687
Luigi Serra
Cross browser con...
|
5
6
|
// Install script dataType
|
c5169e0e
Renato De Donato
a new hope
|
7
|
jQuery.ajaxSetup({
|
74249687
Luigi Serra
Cross browser con...
|
8
|
accepts: {
|
c5169e0e
Renato De Donato
a new hope
|
9
|
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
|
74249687
Luigi Serra
Cross browser con...
|
10
11
|
},
contents: {
|
c5169e0e
Renato De Donato
a new hope
|
12
|
script: /(?:java|ecma)script/
|
74249687
Luigi Serra
Cross browser con...
|
13
14
15
16
17
18
19
|
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
|
c5169e0e
Renato De Donato
a new hope
|
20
|
});
|
74249687
Luigi Serra
Cross browser con...
|
21
22
23
24
25
26
27
28
29
|
// 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";
}
|
c5169e0e
Renato De Donato
a new hope
|
30
|
});
|
74249687
Luigi Serra
Cross browser con...
|
31
32
33
|
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function( s ) {
|
74249687
Luigi Serra
Cross browser con...
|
34
35
36
37
38
|
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script, callback;
return {
send: function( _, complete ) {
|
c5169e0e
Renato De Donato
a new hope
|
39
40
|
script = jQuery("<script>").prop({
async: true,
|
74249687
Luigi Serra
Cross browser con...
|
41
42
|
charset: s.scriptCharset,
src: s.url
|
c5169e0e
Renato De Donato
a new hope
|
43
|
}).on(
|
74249687
Luigi Serra
Cross browser con...
|
44
45
46
47
48
49
50
51
52
|
"load error",
callback = function( evt ) {
script.remove();
callback = null;
if ( evt ) {
complete( evt.type === "error" ? 404 : 200, evt.type );
}
}
);
|
74249687
Luigi Serra
Cross browser con...
|
53
54
55
56
57
58
59
60
61
|
document.head.appendChild( script[ 0 ] );
},
abort: function() {
if ( callback ) {
callback();
}
}
};
}
|
c5169e0e
Renato De Donato
a new hope
|
62
|
});
|
74249687
Luigi Serra
Cross browser con...
|
63
|
|
c5169e0e
Renato De Donato
a new hope
|
64
|
});
|