Skip to content

Commit 1922e9f

Browse files
authored
Merge branch 'main' into legend
2 parents 1ff2eb7 + 17d7b5c commit 1922e9f

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

assets/index.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ function main() {
2727
return
2828
}
2929

30-
// layout
30+
// setup the layout
3131
configureLegend()
3232
configureFileSelect()
3333
addIncrementalButton()
3434
addThemeButton()
3535

36+
// setup the content
3637
configureCodeBlocks()
3738
configureSyntaxHighlight('pre .code .editor')
3839
addCoverageSpans('pre .coverage .editor')
@@ -127,16 +128,11 @@ function configureFileSelect() {
127128
}
128129

129130
document.location.hash = e.target.value
130-
document.querySelectorAll('.file').forEach((el) => (el.style.display = 'none'))
131-
el.style.display = 'block'
132131

133-
let scrollUp = (times) => {
134-
if (window.scrollY === 0 && times > 3) return
135-
window.scrollTo(0, 0)
136-
window.requestAnimationFrame(() => scrollUp(times + 1))
137-
}
132+
document.body.scrollTop = 0;
138133

139-
scrollUp(1)
134+
document.querySelectorAll('.file').forEach((el) => (el.style.display = 'none'))
135+
el.style.display = 'block'
140136
})
141137

142138
files.value = selected

0 commit comments

Comments
 (0)