aboutsummaryrefslogtreecommitdiffstats
path: root/gitweb/static/js/javascript-detection.js
blob: fa2596f77c645b87e79aceb242d6074d6b2764ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// 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)) {
			link.href = link.href.replace(/(#|$)/,
				(link.href.indexOf('?') === -1 ? '?' : ';') + 'js=1$1');
		}
	}
}

/* end of javascript-detection.js */
ff' viewJakub Narebski1-12/+99 2007-06-10gitweb: Add links to blobdiffs in from-file/to-file header for mergesJakub Narebski1-3/+14 2007-06-10gitweb: Create special from-file/to-file header for combined diffJakub Narebski1-11/+27 2007-06-10gitweb: Split git_patchset_body into separate subroutinesJakub Narebski1-111/+202 2007-06-10gitweb: Improve "next" link in commitdiff viewJakub Narebski1-1/+8 2007-06-10gitweb: Provide links to commitdiff to each parent in 'commitdiff' viewJakub Narebski2-0/+26 2007-06-10mktag: minimally update the description.Junio C Hamano1-7/+7 2007-06-10Makefile: add an explicit rule for building assembly outputLinus Torvalds2-1/+3 2007-06-10tutorial: use "project history" instead of "changelog" in headerJ. Bruce Fields1-2/+2 2007-06-10Documentation: user-manual todoJ. Bruce Fields1-0/+4 2007-06-10user-manual: add a missing section IDJ. Bruce Fields1-0/+1 2007-06-10Fix typo in remote branch example in git user manualGerrit Pape1-1/+1 2007-06-10user-manual: quick-start updatesJ. Bruce Fields1-5/+5 2007-06-10git-mergetool: Make default selection of merge-tool more intelligentTheodore Ts'o1-17/+29 2007-06-10[PATCH] git-mergetool: Allow gvimdiff to be used as a mergetoolDan McGee3-4/+12 2007-06-09Remove unnecessary code and comments on non-existing 8kB tag object restrictionJohan Herland1-7/+0 2007-06-09Make command description imperative statement, not third-person present.william pursell3-3/+3 2007-06-09t5000: silence unzip availability checkRené Scharfe1-1/+1 2007-06-09cmd_log_init: remove parsing of --encoding command line parameterJeff King1-7/+1 2007-06-08Even more missing staticJunio C Hamano9-32/+6 2007-06-08More missing staticJunio C Hamano3-6/+4 2007-06-08More missing staticJunio C Hamano2-11/+8 2007-06-08Missing statics.Pierre Habouzit5-7/+7 2007-06-08Active_nr is unsigned, hence can't be < 0Pierre Habouzit1-2/+0 2007-06-08cvsserver: Make req_Root more critical of its input dataFrank Lichtenheld2-0/+45 2007-06-08gitview: Define __slots__ for CommitMichael Ellerman1-0/+3 2007-06-08gitview: Use new-style classesMichael Ellerman1-4/+4 2007-06-08checkout: do not get confused with ambiguous tag/branch namesJunio C Hamano2-1/+42