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 */
d>-4/+94 2018-10-26Sixth batch for 2.20Junio C Hamano1-0/+48 2018-10-19Fifth batch for 2.20Junio C Hamano1-0/+82 2018-10-16Fourth batch for 2.20Junio C Hamano1-0/+50 2018-10-16git-p4: fully support unshelving changelistsLuke Diamand3-51/+106 2018-10-16git-p4: unshelve into refs/remotes/p4-unshelved, not refs/remotes/p4/unshelvedLuke Diamand3-7/+8 2018-10-16mingw: use domain information for default emailJohannes Schindelin4-0/+14 2018-10-16getpwuid(mingw): provide a better default for the user nameJohannes Schindelin1-1/+31 2018-10-16getpwuid(mingw): initialize the structure only onceJohannes Schindelin1-7/+18 2018-10-15fuzz: add fuzz testing for packfile indices.Josh Steadmon5-19/+53 2018-10-15fuzz: add basic fuzz testing target.Josh Steadmon3-0/+48 2018-10-12subtree: performance improvement for finding unexpected parent commitsRoger Strain1-1/+1 2018-10-12diff.c: pass sign_index to emit_line_ws_markupStefan Beller1-7/+5 2018-10-12git-p4: do not fail in verbose mode for missing 'fileSize' keyLuke Diamand1-1/+4 2018-10-12log: fix coloring of certain octopus merge shapesNoam Postavsky2-15/+145 2018-10-12doc: move git-cherry to plumbingDaniels Umanovskis2-12/+1 2018-10-12doc: move git-get-tar-commit-id to plumbingDaniels Umanovskis1-1/+1 2018-10-12split-index: BUG() when cache entry refers to non-existing shared entrySZEDER Gábor1-2/+2 2018-10-12split-index: smudge and add racily clean cache entries to split indexSZEDER Gábor4-8/+46 2018-10-12split-index: don't compare cached data of entries already marked for split indexSZEDER Gábor1-17/+72 2018-10-12split-index: count the number of deleted entriesSZEDER Gábor1-1/+1 2018-10-12t1700-split-index: date back files to avoid racy situationsSZEDER Gábor1-21/+28