scratch – Blame information for rev 125
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
125 | office | 1 | define([ |
58 | office | 2 | "../core", |
3 | "../ajax" |
||
125 | office | 4 | ], function( jQuery ) { |
58 | office | 5 | |
6 | // Install script dataType |
||
125 | office | 7 | jQuery.ajaxSetup({ |
58 | office | 8 | accepts: { |
125 | office | 9 | script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" |
58 | office | 10 | }, |
11 | contents: { |
||
125 | office | 12 | script: /(?:java|ecma)script/ |
58 | office | 13 | }, |
14 | converters: { |
||
15 | "text script": function( text ) { |
||
16 | jQuery.globalEval( text ); |
||
17 | return text; |
||
18 | } |
||
19 | } |
||
125 | office | 20 | }); |
58 | office | 21 | |
22 | // Handle cache's special case and crossDomain |
||
23 | jQuery.ajaxPrefilter( "script", function( s ) { |
||
24 | if ( s.cache === undefined ) { |
||
25 | s.cache = false; |
||
26 | } |
||
27 | if ( s.crossDomain ) { |
||
28 | s.type = "GET"; |
||
29 | } |
||
125 | office | 30 | }); |
58 | office | 31 | |
32 | // Bind script tag hack transport |
||
33 | jQuery.ajaxTransport( "script", function( s ) { |
||
34 | // This transport only deals with cross domain requests |
||
35 | if ( s.crossDomain ) { |
||
36 | var script, callback; |
||
37 | return { |
||
38 | send: function( _, complete ) { |
||
125 | office | 39 | script = jQuery("<script>").prop({ |
40 | async: true, |
||
58 | office | 41 | charset: s.scriptCharset, |
42 | src: s.url |
||
125 | office | 43 | }).on( |
58 | office | 44 | "load error", |
45 | callback = function( evt ) { |
||
46 | script.remove(); |
||
47 | callback = null; |
||
48 | if ( evt ) { |
||
49 | complete( evt.type === "error" ? 404 : 200, evt.type ); |
||
50 | } |
||
51 | } |
||
52 | ); |
||
53 | document.head.appendChild( script[ 0 ] ); |
||
54 | }, |
||
55 | abort: function() { |
||
56 | if ( callback ) { |
||
57 | callback(); |
||
58 | } |
||
59 | } |
||
60 | }; |
||
61 | } |
||
125 | office | 62 | }); |
58 | office | 63 | |
125 | office | 64 | }); |