55 lines
2.0 KiB
HTML
55 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
{{ partial "head.html" . }}
|
|
</head>
|
|
<body id="top">
|
|
<a class="skip" href="#content">Skip to content</a>
|
|
{{ partial "header.html" . }}
|
|
<main id="content" tabindex="-1">
|
|
{{ block "main" . }}{{ end }}
|
|
</main>
|
|
{{ partial "footer.html" . }}
|
|
<script>
|
|
/* Progressive only: fade sections in as they scroll into view, and
|
|
darken the top bar once the page has scrolled. */
|
|
(function () {
|
|
var root = document.documentElement;
|
|
var head = document.querySelector('.site-head');
|
|
function onScroll() { if (head) head.classList.toggle('is-scrolled', scrollY > 8); }
|
|
addEventListener('scroll', onScroll, { passive: true });
|
|
onScroll();
|
|
if (!('IntersectionObserver' in window)) return;
|
|
root.classList.add('js');
|
|
|
|
var io = new IntersectionObserver(function (entries) {
|
|
entries.forEach(function (e) {
|
|
if (e.isIntersecting) { e.target.classList.add('is-visible'); io.unobserve(e.target); }
|
|
});
|
|
}, { rootMargin: '0px 0px -8% 0px' });
|
|
document.querySelectorAll('[data-reveal]').forEach(function (el) { io.observe(el); });
|
|
})();
|
|
|
|
/* A Copy button on every terminal block (needs the Clipboard API). */
|
|
(function () {
|
|
if (!navigator.clipboard) return;
|
|
document.querySelectorAll('.prose pre, .term-body, .sib-cmd').forEach(function (block) {
|
|
var btn = document.createElement('button');
|
|
btn.type = 'button';
|
|
btn.className = 'copy-btn';
|
|
btn.textContent = 'Copy';
|
|
btn.addEventListener('click', function () {
|
|
var code = block.querySelector('code') || block;
|
|
navigator.clipboard.writeText(code.textContent.replace(/\n$/, '')).then(function () {
|
|
btn.textContent = 'Copied';
|
|
setTimeout(function () { btn.textContent = 'Copy'; }, 1600);
|
|
});
|
|
});
|
|
(block.closest('.term') || block).appendChild(btn);
|
|
if (!block.closest('.term')) block.classList.add('has-copy');
|
|
});
|
|
})();
|
|
</script>
|
|
</body>
|
|
</html>
|