 9a86dd5710
			
		
	
	9a86dd5710
	
	
	
		
			
			Split originally single gitweb.js file into smaller files, each dealing with single issue / area of responsibility. This move should make gitweb's JavaScript code easier to maintain. For better webapp performance it is recommended[1][2][3] to combine JavaScript files. Do it during build time (in gitweb/Makefile), by straight concatenation of files into gitweb.js file (which is now ignored as being generated). This means that there are no changes to gitweb script itself - it still uses gitweb.js or gitweb.min.js, but now generated. [1]: http://developer.yahoo.com/performance/rules.html "Minimize HTTP Requests" section [2]: http://code.google.com/speed/articles/include-scripts-properly.html "1. Combine external JavaScript files" [3]: http://javascript-reference.info/speed-up-your-javascript-load-time.htm "Combine Your Files" section. See also new gitweb/static/js/README file. Inspired-by-patch-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // Copyright (C) 2007, Fredrik Kuivinen <frekui@gmail.com>
 | |
| //               2007, Petr Baudis <pasky@suse.cz>
 | |
| //          2008-2011, Jakub Narebski <jnareb@gmail.com>
 | |
| 
 | |
| /**
 | |
|  * @fileOverview Detect if JavaScript is enabled, and pass it to server-side
 | |
|  * @license GPLv2 or later
 | |
|  */
 | |
| 
 | |
| 
 | |
| /* ============================================================ */
 | |
| /* Manipulating links */
 | |
| 
 | |
| /**
 | |
|  * used to check if link has 'js' query parameter already (at end),
 | |
|  * and other reasons to not add 'js=1' param at the end of link
 | |
|  * @constant
 | |
|  */
 | |
| var jsExceptionsRe = /[;?]js=[01]$/;
 | |
| 
 | |
| /**
 | |
|  * Add '?js=1' or ';js=1' to the end of every link in the document
 | |
|  * that doesn't have 'js' query parameter set already.
 | |
|  *
 | |
|  * Links with 'js=1' lead to JavaScript version of given action, if it
 | |
|  * exists (currently there is only 'blame_incremental' for 'blame')
 | |
|  *
 | |
|  * To be used as `window.onload` handler
 | |
|  *
 | |
|  * @globals jsExceptionsRe
 | |
|  */
 | |
| function fixLinks() {
 | |
| 	var allLinks = document.getElementsByTagName("a") || document.links;
 | |
| 	for (var i = 0, len = allLinks.length; i < len; i++) {
 | |
| 		var link = allLinks[i];
 | |
| 		if (!jsExceptionsRe.test(link)) { // =~ /[;?]js=[01]$/;
 | |
| 			link.href +=
 | |
| 				(link.href.indexOf('?') === -1 ? '?' : ';') + 'js=1';
 | |
| 		}
 | |
| 	}
 | |
| }
 | |
| 
 | |
| /* end of javascript-detection.js */
 |