1- /*
2- <?php
3- // if php is available, close the comment so PHP can echo the appropriate JS
4- echo "* " . "/ " ;
5-
6- // initialize vars
7- $ output = "" ;
8- $ version = "" ;
9-
10- // extract vars from referrer to determine version
11- if (isset ($ _SERVER ['HTTP_REFERER ' ])){
12- $ referrer = $ _SERVER ['HTTP_REFERER ' ];
13- $ referrer_query_string = parse_url ($ _SERVER ['HTTP_REFERER ' ], PHP_URL_QUERY );
14- parse_str ($ referrer_query_string , $ referrer_params );
15-
16- if (isset ($ referrer_params ['jquery ' ])){
17- $ version = $ referrer_params ['jquery ' ];
18- }
1+ (function() {
2+
3+ window.hasPHP = false /* <?php echo "* " + "/ || true /* " ; ?> */;
4+
5+ if ( !window.top.jQueryIncludes ) {
6+
7+ window.top.jQueryIncludes = (function() {
8+
9+ var location = window.top.document.location.href,
10+ baseURL = location.replace( /\/test\/.+/, "/"),
11+ version = /(?:&|\?)jquery=([^&]+?)(?:$|&)/.exec( location ),
12+ includes, i;
13+
14+ if ( version ) {
15+ version = version[ 1 ];
16+ if( version === "min" ) {
17+ includes = [ baseURL + "dist/jquery.min.js" ];
18+ } else if( version === "dist" ) {
19+ includes = [ baseURL + "dist/jquery.js" ];
20+ } else {
21+ includes = [ "http://code.jquery.com/jquery-" + version + ".js" ];
22+ }
23+ } else {
24+ includes = [
25+ "core",
26+ "callbacks",
27+ "deferred",
28+ "support",
29+ "data",
30+ "queue",
31+ "attributes",
32+ "event",
33+ "sizzle/sizzle",
34+ "sizzle-jquery",
35+ "traversing",
36+ "manipulation",
37+ "css",
38+ "ajax",
39+ "ajax/jsonp",
40+ "ajax/script",
41+ "ajax/xhr",
42+ "effects",
43+ "offset",
44+ "dimensions",
45+ "exports"
46+ ];
47+ for ( i = includes.length; i--; ) {
48+ includes[ i ] = baseURL + "src/" + includes[ i ] + ".js";
49+ }
50+ }
51+
52+ for ( i = includes.length; i--; ) {
53+ includes[ i ] = "<script src='" + includes[ i ] + "'><" + "/script>";
54+ }
55+
56+ return includes.join( "\n" );
57+ })();
1958}
2059
21- // load up built versions of jquery
22- if ( $ version === "min " ) {
23- $ output = @file_get_contents ("../../dist/jquery.min.js " );
24- }elseif ( $ version === "dist " ) {
25- $ output = @file_get_contents ("../../dist/jquery.js " );
26- }elseif ( ctype_digit ( substr ( $ version , 0 , 1 )) || $ version === "git " ) {
27- $ output = "document.write('<script src= \"http://code.jquery.com/jquery- " . $ version . ".js \"><'+'/script>'); " ;
28- }
29-
30- // the concatenated version of the the src files is both the default and the fallback
31- // because it does not require you to "make" jquery for it to update
32- if ( $ output === "" ) {
33- $ files = array (
34- "intro " ,
35- "core " ,
36- "callbacks " ,
37- "deferred " ,
38- "support " ,
39- "data " ,
40- "queue " ,
41- "attributes " ,
42- "event " ,
43- "sizzle/sizzle " ,
44- "sizzle-jquery " ,
45- "traversing " ,
46- "manipulation " ,
47- "css " ,
48- "ajax " ,
49- "ajax/jsonp " ,
50- "ajax/script " ,
51- "ajax/xhr " ,
52- "effects " ,
53- "offset " ,
54- "dimensions " ,
55- "exports " ,
56- "outro "
57- );
58-
59- foreach ( $ files as $ file ) {
60- $ output .= file_get_contents ( "../../src/ " . $ file . ".js " );
61- }
62-
63- $ output = str_replace ( "(function( jQuery ) { " , "" , $ output );
64- $ output = str_replace ( "})( jQuery ); " , "" , $ output );
65- }
66-
67- echo $ output ;
68- die ();
69- ?>
70- */
71-
72- hasPHP = false;
73-
74- // javascript fallback using src files in case this is not run on a PHP server!
75- // please note that this fallback is for convenience only, and is not fully supported
76- // i.e. don't expect all of the tests to work properly
77- var baseURL = document.location.href.replace( /\/test\/.+/, "/"),
78- files = [
79- "core",
80- "callbacks",
81- "deferred",
82- "support",
83- "data",
84- "queue",
85- "attributes",
86- "event",
87- "sizzle/sizzle",
88- "sizzle-jquery",
89- "traversing",
90- "manipulation",
91- "css",
92- "ajax",
93- "ajax/jsonp",
94- "ajax/script",
95- "ajax/xhr",
96- "effects",
97- "offset",
98- "dimensions",
99- "exports"
100- ],
101- len = files.length,
102- i = 0;
60+ document.write( window.top.jQueryIncludes );
10361
104- for ( ; i < len; i++ ) {
105- document.write("<script src=\"" + baseURL + "src/" + files[ i ] + ".js\"><"+"/script>");
106- }
62+ })();
0 commit comments