Commit 8d94ed91 authored by Dave Methvin's avatar Dave Methvin

Revert "No more php/js logic duplication..." on a hunch.

TestSwarm hasn't been happy since this commit, and everyone deserves to be happy.

This reverts commit 318d47b7.
parent ae138ac6
(function() { /*
<?php
// if php is available, close the comment so PHP can echo the appropriate JS
echo "*" . "/";
window.hasPHP = false /* <?php echo "*" . "/ || true /*"; ?> */; // initialize vars
$output = "";
$version = "";
if ( !window.top.jQueryIncludes ) { // extract vars from referrer to determine version
if(isset($_SERVER['HTTP_REFERER'])){
$referrer = $_SERVER['HTTP_REFERER'];
$referrer_query_string = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY );
parse_str($referrer_query_string, $referrer_params);
window.top.jQueryIncludes = (function() { if(isset($referrer_params['jquery'])){
$version = $referrer_params['jquery'];
}
}
var location = window.top.document.location.href, // load up built versions of jquery
baseURL = location.replace( /\/test\/.*/, "/"), if( $version === "min" ) {
version = /(?:&|\?)jquery=([^&]+?)(?:$|&)/.exec( location ), $output = @file_get_contents("../../dist/jquery.min.js");
includes, i; }elseif( $version === "dist" ) {
$output = @file_get_contents("../../dist/jquery.js");
}elseif( ctype_digit( substr( $version, 0, 1 )) || $version === "git" ) {
$output = "document.write('<script src=\"http://code.jquery.com/jquery-" . $version . ".js\"><'+'/script>');";
}
if ( version ) { // the concatenated version of the the src files is both the default and the fallback
version = version[ 1 ]; // because it does not require you to "make" jquery for it to update
if( version === "min" ) { if( $output === "" ) {
includes = [ baseURL + "dist/jquery.min.js" ]; $files = array(
} else if( version === "dist" ) { "intro",
includes = [ baseURL + "dist/jquery.js" ];
} else {
includes = [ "http://code.jquery.com/jquery-" + version + ".js" ];
}
} else {
includes = [
"core", "core",
"callbacks", "callbacks",
"deferred", "deferred",
...@@ -42,21 +52,55 @@ if ( !window.top.jQueryIncludes ) { ...@@ -42,21 +52,55 @@ if ( !window.top.jQueryIncludes ) {
"effects", "effects",
"offset", "offset",
"dimensions", "dimensions",
"exports" "exports",
]; "outro"
for ( i = includes.length; i--; ) { );
includes[ i ] = baseURL + "src/" + includes[ i ] + ".js";
}
}
for ( i = includes.length; i--; ) { foreach ( $files as $file ) {
includes[ i ] = "<script src='" + includes[ i ] + "'><" + "/script>"; $output .= file_get_contents( "../../src/" . $file . ".js" );
} }
return includes.join( "\n" ); $output = str_replace( "(function( jQuery ) {", "", $output );
})(); $output = str_replace( "})( jQuery );", "", $output );
} }
document.write( window.top.jQueryIncludes ); echo $output;
die();
?>
*/
hasPHP = false;
})(); // javascript fallback using src files in case this is not run on a PHP server!
// please note that this fallback is for convenience only, and is not fully supported
// i.e. don't expect all of the tests to work properly
var baseURL = document.location.href.replace( /\/test\/.+/, "/"),
files = [
"core",
"callbacks",
"deferred",
"support",
"data",
"queue",
"attributes",
"event",
"sizzle/sizzle",
"sizzle-jquery",
"traversing",
"manipulation",
"css",
"ajax",
"ajax/jsonp",
"ajax/script",
"ajax/xhr",
"effects",
"offset",
"dimensions",
"exports"
],
len = files.length,
i = 0;
for ( ; i < len; i++ ) {
document.write("<script src=\"" + baseURL + "src/" + files[ i ] + ".js\"><"+"/script>");
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment