Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Community Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bio-IT
Community Documentation
Commits
008809e0
Commit
008809e0
authored
5 years ago
by
Silvio Giebl
Browse files
Options
Downloads
Patches
Plain Diff
Include custom js, added js namespace
parent
96653f6d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
assets/js/_custom.js
+0
-0
0 additions, 0 deletions
assets/js/_custom.js
assets/js/just-the-docs.js
+28
-23
28 additions, 23 deletions
assets/js/just-the-docs.js
with
28 additions
and
23 deletions
assets/js/_custom.js
0 → 100644
+
0
−
0
View file @
008809e0
This diff is collapsed.
Click to expand it.
assets/js/just-the-docs.js
+
28
−
23
View file @
008809e0
---
---
---
---
(
function
(
jtd
,
undefined
)
{
// Event handling
// Event handling
function
addEvent
(
el
,
type
,
handler
)
{
jtd
.
addEvent
=
function
(
el
,
type
,
handler
)
{
if
(
el
.
attachEvent
)
el
.
attachEvent
(
'
on
'
+
type
,
handler
);
else
el
.
addEventListener
(
type
,
handler
);
if
(
el
.
attachEvent
)
el
.
attachEvent
(
'
on
'
+
type
,
handler
);
else
el
.
addEventListener
(
type
,
handler
);
}
}
function
removeEvent
(
el
,
type
,
handler
)
{
jtd
.
removeEvent
=
function
(
el
,
type
,
handler
)
{
if
(
el
.
detachEvent
)
el
.
detachEvent
(
'
on
'
+
type
,
handler
);
else
el
.
removeEventListener
(
type
,
handler
);
if
(
el
.
detachEvent
)
el
.
detachEvent
(
'
on
'
+
type
,
handler
);
else
el
.
removeEventListener
(
type
,
handler
);
}
jtd
.
onReady
=
function
(
ready
)
{
// in case the document is already rendered
if
(
document
.
readyState
!=
'
loading
'
)
ready
();
// modern browsers
else
if
(
document
.
addEventListener
)
document
.
addEventListener
(
'
DOMContentLoaded
'
,
ready
);
// IE <= 8
else
document
.
attachEvent
(
'
onreadystatechange
'
,
function
(){
if
(
document
.
readyState
==
'
complete
'
)
ready
();
});
}
}
// Show/hide mobile menu
// Show/hide mobile menu
function
toggle
Nav
(){
function
init
Nav
()
{
const
mainNav
=
document
.
querySelector
(
'
.js-main-nav
'
);
const
mainNav
=
document
.
querySelector
(
'
.js-main-nav
'
);
const
pageHeader
=
document
.
querySelector
(
'
.js-page-header
'
);
const
pageHeader
=
document
.
querySelector
(
'
.js-page-header
'
);
const
navTrigger
=
document
.
querySelector
(
'
.js-main-nav-trigger
'
);
const
navTrigger
=
document
.
querySelector
(
'
.js-main-nav-trigger
'
);
addEvent
(
navTrigger
,
'
click
'
,
function
(
e
){
jtd
.
addEvent
(
navTrigger
,
'
click
'
,
function
(
e
){
e
.
preventDefault
();
e
.
preventDefault
();
var
text
=
navTrigger
.
innerText
;
var
text
=
navTrigger
.
innerText
;
var
textToggle
=
navTrigger
.
getAttribute
(
'
data-text-toggle
'
);
var
textToggle
=
navTrigger
.
getAttribute
(
'
data-text-toggle
'
);
...
@@ -37,7 +48,7 @@ function initSearch() {
...
@@ -37,7 +48,7 @@ function initSearch() {
var
request
=
new
XMLHttpRequest
();
var
request
=
new
XMLHttpRequest
();
request
.
open
(
'
GET
'
,
'
{{ "assets/js/search-data.json" | absolute_url }}
'
,
true
);
request
.
open
(
'
GET
'
,
'
{{ "assets/js/search-data.json" | absolute_url }}
'
,
true
);
request
.
onload
=
function
()
{
request
.
onload
=
function
(){
if
(
request
.
status
>=
200
&&
request
.
status
<
400
)
{
if
(
request
.
status
>=
200
&&
request
.
status
<
400
)
{
// Success!
// Success!
var
data
=
JSON
.
parse
(
request
.
responseText
);
var
data
=
JSON
.
parse
(
request
.
responseText
);
...
@@ -67,7 +78,7 @@ function initSearch() {
...
@@ -67,7 +78,7 @@ function initSearch() {
}
}
};
};
request
.
onerror
=
function
()
{
request
.
onerror
=
function
(){
// There was a connection error of some sort
// There was a connection error of some sort
console
.
log
(
'
There was a connection error
'
);
console
.
log
(
'
There was a connection error
'
);
};
};
...
@@ -85,7 +96,7 @@ function initSearch() {
...
@@ -85,7 +96,7 @@ function initSearch() {
searchResults
.
classList
.
remove
(
'
active
'
);
searchResults
.
classList
.
remove
(
'
active
'
);
}
}
addEvent
(
searchInput
,
'
keydown
'
,
function
(
e
){
jtd
.
addEvent
(
searchInput
,
'
keydown
'
,
function
(
e
){
switch
(
e
.
keyCode
)
{
switch
(
e
.
keyCode
)
{
case
38
:
// arrow up
case
38
:
// arrow up
e
.
preventDefault
();
e
.
preventDefault
();
...
@@ -129,7 +140,7 @@ function initSearch() {
...
@@ -129,7 +140,7 @@ function initSearch() {
}
}
});
});
addEvent
(
searchInput
,
'
keyup
'
,
function
(
e
){
jtd
.
addEvent
(
searchInput
,
'
keyup
'
,
function
(
e
){
switch
(
e
.
keyCode
)
{
switch
(
e
.
keyCode
)
{
case
27
:
// When esc key is pressed, hide the results and clear the field
case
27
:
// When esc key is pressed, hide the results and clear the field
hideResults
();
hideResults
();
...
@@ -252,7 +263,7 @@ function initSearch() {
...
@@ -252,7 +263,7 @@ function initSearch() {
}
}
});
});
addEvent
(
searchInput
,
'
blur
'
,
function
(){
jtd
.
addEvent
(
searchInput
,
'
blur
'
,
function
(){
setTimeout
(
function
(){
hideResults
()
},
300
);
setTimeout
(
function
(){
hideResults
()
},
300
);
});
});
}
}
...
@@ -263,22 +274,16 @@ function pageFocus() {
...
@@ -263,22 +274,16 @@ function pageFocus() {
mainContent
.
focus
();
mainContent
.
focus
();
}
}
// Document ready
// Document ready
function
ready
(){
jtd
.
onReady
(
function
(){
toggle
Nav
();
init
Nav
();
pageFocus
();
pageFocus
();
if
(
typeof
lunr
!==
'
undefined
'
)
{
if
(
typeof
lunr
!==
'
undefined
'
)
{
initSearch
();
initSearch
();
}
}
}
// in case the document is already rendered
if
(
document
.
readyState
!=
'
loading
'
)
ready
();
// modern browsers
else
if
(
document
.
addEventListener
)
document
.
addEventListener
(
'
DOMContentLoaded
'
,
ready
);
// IE <= 8
else
document
.
attachEvent
(
'
onreadystatechange
'
,
function
(){
if
(
document
.
readyState
==
'
complete
'
)
ready
();
});
});
})(
window
.
jtd
=
window
.
jtd
||
{});
{
%
include_relative
_custom
.
js
%
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment