blob: 95ad419aa6a377213fb52b5e74ff3cab6770e6f2 (
plain)
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
|
// const THRESHOLD_FIDELITY = 150;
// accessibility tab index
const sectionsAndHeaders = document.querySelectorAll('section, header');
sectionsAndHeaders.forEach(ele => ele.tabIndex = "0");
// mutation observer for the video element
// const videoTitle = document.querySelector('#video-title');
// // const pastryIframe = document.querySelector('#connie-pastries')
// const observer = new IntersectionObserver(entries => {
// // note - if the boundingClientRect.y is negative, then they are scrolling down
// // note - since using id, only 1 entry
// const {intersectionRatio} = entries[0];
// if (intersectionRatio !== 1) {
// videoTitle.currentTime = 5 - 3 * intersectionRatio;
// } else {
// videoTitle.currentTime = 2;
// }
// }, {
// threshold: [...Array(THRESHOLD_FIDELITY).keys()].map(num => num/THRESHOLD_FIDELITY),
// rootMargin: '-100px 0px 0px 0px'
// });
// after two seconds pause the video
// setTimeout(() => {
// videoTitle.pause();
// videoTitle.currentTime = 2;
// observer.observe(videoTitle);
// }, 2500)
// borrowed from https://www.w3schools.com/howto/howto_js_collapse_sidepanel.asp
/* Set the width of the sidebar to 250px (show it) */
openNav = () => {
document.querySelector('#sidepanel').style.width = "250px";
}
/* Set the width of the sidebar to 0 (hide it) */
closeNav = () => {
document.querySelector('#sidepanel').style.width = "0";
}
|