jquery.js 580 B

123456789101112131415161718192021222324252627
  1. (function() {
  2. var parts = document.location.search.slice( 1 ).split( "&" ),
  3. length = parts.length,
  4. scripts = document.getElementsByTagName("script"),
  5. src = scripts[ scripts.length - 1].src,
  6. i = 0,
  7. current,
  8. version = "3.1.1",
  9. file = "http://code.jquery.com/jquery-git.js";
  10. for ( ; i < length; i++ ) {
  11. current = parts[ i ].split( "=" );
  12. if ( current[ 0 ] === "jquery" ) {
  13. version = current[ 1 ];
  14. break;
  15. }
  16. }
  17. if (version != "git") {
  18. file = src.replace(/jquery\.js$/, "jquery-" + version + ".js");
  19. }
  20. document.write( "<script src='" + file + "'></script>" );
  21. })();