Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/gitweb/static/js/javascript-detection.js # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / gitweb / static / js / javascript-detection.js` 43 lines ยท 1278 bytes Raw Blame History 1 // Copyright (C) 2007, Fredrik Kuivinen 2 // 2007, Petr Baudis 3 // 2008-2011, Jakub Narebski 4 5 /** 6 * @fileOverview Detect if JavaScript is enabled, and pass it to server-side 7 * @license GPLv2 or later 8 */ 9 10 11 /* ============================================================ */ 12 /* Manipulating links */ 13 14 /** 15 * used to check if link has 'js' query parameter already (at end), 16 * and other reasons to not add 'js=1' param at the end of link 17 * @constant 18 */ 19 var jsExceptionsRe = /[;?]js=[01](#.*)?$/; 20 21 /** 22 * Add '?js=1' or ';js=1' to the end of every link in the document 23 * that doesn't have 'js' query parameter set already. 24 * 25 * Links with 'js=1' lead to JavaScript version of given action, if it 26 * exists (currently there is only 'blame_incremental' for 'blame') 27 * 28 * To be used as `window.onload` handler 29 * 30 * @globals jsExceptionsRe 31 */ 32 function fixLinks() { 33 var allLinks = document.getElementsByTagName("a") || document.links; 34 for (var i = 0, len = allLinks.length; i < len; i++) { 35 var link = allLinks[i]; 36 if (!jsExceptionsRe.test(link)) { 37 link.href = link.href.replace(/(#|$)/, 38 (link.href.indexOf('?') === -1 ? '?' : ';') + 'js=1$1'); 39 } 40 } 41 } 42 43 /* end of javascript-detection.js */