-
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca66f94
commit 6b516f4
Showing
3 changed files
with
76 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,63 @@ | ||
function toggleLayout() { | ||
const layout = document.querySelector('#panel input[name="layout"]:checked').value | ||
const layout = document.querySelector('#panel input[name="layout"]:checked').value; | ||
if (layout === 'vertical') { | ||
document.body.removeAttribute('data-horizontal') | ||
const lboxes = document.querySelectorAll('.l-box') | ||
document.body.removeAttribute('data-horizontal'); | ||
const lboxes = document.querySelectorAll('.l-box'); | ||
for (const box of lboxes) { | ||
box.removeAttribute('data-horizontal') | ||
box.removeAttribute('data-horizontal'); | ||
} | ||
const rboxes = document.querySelectorAll('.r-box') | ||
const rboxes = document.querySelectorAll('.r-box'); | ||
for (const box of rboxes) { | ||
box.removeAttribute('data-horizontal') | ||
box.removeAttribute('data-horizontal'); | ||
} | ||
} else { | ||
document.body.setAttribute('data-horizontal', '') | ||
const lboxes = document.querySelectorAll('.l-box') | ||
document.body.setAttribute('data-horizontal', ''); | ||
const lboxes = document.querySelectorAll('.l-box'); | ||
for (const box of lboxes) { | ||
box.setAttribute('data-horizontal', '') | ||
box.setAttribute('data-horizontal', ''); | ||
} | ||
const rboxes = document.querySelectorAll('.r-box') | ||
const rboxes = document.querySelectorAll('.r-box'); | ||
for (const box of rboxes) { | ||
box.setAttribute('data-horizontal', '') | ||
box.setAttribute('data-horizontal', ''); | ||
} | ||
} | ||
} | ||
|
||
function toggleExpand() { | ||
const expand = document.querySelector('#panel input[name="expand"]:checked').value | ||
const entries = document.querySelectorAll('details.collapse.entry') | ||
const expand = document.querySelector('#panel input[name="expand"]:checked').value; | ||
const entries = document.querySelectorAll('details.collapse.entry'); | ||
for (const entry of entries) { | ||
switch (expand) { | ||
case 'all': | ||
entry.open = true | ||
break | ||
entry.open = true; | ||
break; | ||
case 'diff-only': | ||
entry.open = entry.hasAttribute('data-mark-red') | ||
break | ||
entry.open = entry.hasAttribute('data-mark-red'); | ||
break; | ||
case 'none': | ||
entry.open = false | ||
break | ||
entry.open = false; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
function goToTop() { | ||
document.body.scrollTop = 0; | ||
document.documentElement.scrollTop = 0; | ||
} | ||
|
||
function scrollHandler() { | ||
const topButton = document.querySelector('#top-button'); | ||
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { | ||
topButton.classList.add('show'); | ||
} else { | ||
topButton.classList.remove('show'); | ||
} | ||
} | ||
|
||
document.addEventListener('scroll', scrollHandler); | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
document.querySelectorAll('.latex').forEach(renderMathInElement) | ||
}) | ||
scrollHandler(); | ||
document.querySelectorAll('.latex').forEach(renderMathInElement); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters