FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docs/javascripts/sidebar.js at main · yec/docs · GitHub
yec
/
docs
Public
forked from
github/docs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
docs
/
javascripts
/
sidebar.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (22 loc) · 1.06 KB
Breadcrumbs
docs
/
javascripts
/
sidebar.js
Copy path
File metadata and controls
28 lines (22 loc) · 1.06 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
export
default
function
(
)
{
// TODO override active classes set on server side if sidebar elements are clicked
const
activeMenuItem
=
document
.
querySelector
(
'.sidebar .active'
)
if
(
!
activeMenuItem
)
return
const
verticalBufferAboveActiveItem
=
40
const
activeMenuItemPosition
=
activeMenuItem
.
offsetTop
-
verticalBufferAboveActiveItem
const
menu
=
document
.
querySelector
(
'.sidebar'
)
if
(
activeMenuItemPosition
>
(
window
.
innerHeight
*
0.5
)
)
{
menu
.
scrollTo
(
0
,
activeMenuItemPosition
)
}
// if the active category is a standalone category, do not close the other open dropdowns
const
activeStandaloneCategory
=
document
.
querySelectorAll
(
'.sidebar-category.active.standalone-category'
)
if
(
activeStandaloneCategory
.
length
)
return
const
allOpenDetails
=
document
.
querySelectorAll
(
'.sidebar-category:not(.active) details[open]'
)
if
(
allOpenDetails
)
{
for
(
const
openDetail
of
allOpenDetails
)
{
openDetail
.
removeAttribute
(
'open'
)
const
svgArrowElem
=
openDetail
.
querySelector
(
'summary > div > svg'
)
svgArrowElem
.
remove
(
)
}
}
}
Back
|
FazBrowse Home
|
New Git URL