-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocinfo-footer.html
More file actions
38 lines (32 loc) · 1.45 KB
/
docinfo-footer.html
File metadata and controls
38 lines (32 loc) · 1.45 KB
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
<div id="footer">
<div id="footer-text">
Zuletzt geändert: {docdatetime}
|
Icons von <a href="https://www.flaticon.com/free-icons/edit" title="edit icons">Freepik - Flaticon</a>
| <a href="https://github.com/ideadapt/programmieren-lernen-mit-javascript" title="GitHub Repository">Source Code</a>
| Lizenziert als <a href="https://www.tldrlegal.com/l/gpl-3.0">GPL-3.0</a>
</div>
</div>
<script src="//julesfouchy.github.io/p5.js-widget/p5-widget.js" defer></script>
<script defer>
const isInViewport = (rect) => rect.top >= 0 && rect.bottom <= window.innerHeight
function debounce(func, timeout = 300){
let timer;
return (...args) => {
clearTimeout(timer)
timer = setTimeout(() => { func.apply(this, args); }, timeout)
}
}
window.addEventListener('load', () => {
const hs = [...document.querySelectorAll('#content h1, #content h2, #content h3, #content h4')]
const refs = new Map([...document.querySelectorAll('#toc [href]')].map(a => [a.getAttribute('href').substring(1), a]))
const refAs = [...refs.values()]
document.addEventListener('scroll', debounce(() => {
refAs.forEach(a => a.classList.remove('in-view'))
const h = hs.find(r => isInViewport(r.getBoundingClientRect()))
if(h){
refs.get(h.getAttribute('id')).classList.add('in-view')
}
}, 200))
})
</script>