FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
git.github.io/gitweb/static/js/javascript-detection.js at next · USDOS/git.github.io · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
USDOS
/
git.github.io
Public
forked from
git/git
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
1
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
git.github.io
/
gitweb
/
static
/
js
/
javascript-detection.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (37 loc) · 1.25 KB
Breadcrumbs
git.github.io
/
gitweb
/
static
/
js
/
javascript-detection.js
Copy path
File metadata and controls
43 lines (37 loc) · 1.25 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
=
/
[
;
?
]
j
s
=
[
0
1
]
(
#
.
*
)
?
$
/
;
/**
* 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 */
Back
|
FazBrowse Home
|
New Git URL