spec/_layouts/spec.html

92 lines
2.4 KiB
HTML
Raw Normal View History

2018-12-21 01:00:02 +01:00
<!DOCTYPE html>
<html>
<head>
<title>{{ site.title }}</title>
<meta charset="utf-8">
2018-11-27 20:25:36 +01:00
<meta name="viewport" content="width=device-width,initial-scale=1">
2018-10-17 21:06:31 +02:00
<link rel="stylesheet" type="text/css" href="normalize.css">
2018-11-01 18:39:04 +01:00
<link rel="stylesheet" type="text/css" href="tocbot.css">
2018-10-17 21:06:31 +02:00
<link rel="stylesheet" type="text/css" href="style.css">
2018-12-21 01:00:02 +01:00
</head>
<body>
<main>
<h1>LBRY: A Decentralized Digital Content Marketplace</h1>
<div class="toc-menu">Menu</div>
<nav class="toc"></nav>
<div id="content">
{{ content }}
</div>
</main>
<script src="https://hypothes.is/embed.js" async></script>
2018-11-01 18:39:04 +01:00
<script src="tocbot.min.js"></script>
<script>
function ready(fn) {
if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
function toggleClass(el, className) {
if (el.classList) {
el.classList.toggle(className);
} else {
var classes = el.className.split(' ');
var existingIndex = classes.indexOf(className);
if (existingIndex >= 0)
classes.splice(existingIndex, 1);
else
classes.push(className);
el.className = classes.join(' ');
}
}
2018-11-01 18:39:04 +01:00
ready(function() {
2018-12-21 01:00:02 +01:00
// Handle external links
const links = document.links;
for (var i = 0; i < links.length; i++) {
if (links[i].hostname != window.location.hostname) {
links[i].target = '_blank';
links[i].className += ' external-link';
links[i].rel = "noopener";
}
}
// TOCbot
var options = {
tocSelector: '.toc',
2018-11-01 18:39:04 +01:00
contentSelector: '#content',
headingSelector: 'h2, h3, h4, h5, h6',
collapseDepth: 3,
positionFixedSelector: ".toc",
};
tocbot.init(options);
document.querySelector('.toc-menu').addEventListener("click", function() {
toggleClass(document.querySelector('.toc'), "open");
});
2018-12-21 01:00:02 +01:00
// need this part to fix toc offset height if content above toc changes height
var resizeTimer;
window.addEventListener('resize', function(e) {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
o = options;
2018-12-21 01:00:02 +01:00
o.fixedSidebarOffset = "auto";
tocbot.refresh(o);
}, 250);
2018-11-01 18:39:04 +01:00
});
})
2018-12-21 01:00:02 +01:00
</script>
</body>
</html>