88 lines
2.2 KiB
HTML
Executable File
88 lines
2.2 KiB
HTML
Executable File
<script>
|
|
{
|
|
{
|
|
with .
|
|
Scratch.Get
|
|
"repo_id"
|
|
}
|
|
}
|
|
var base_url = '{{ (printf "%s" $.Site.BaseURL) | safeJS }}';
|
|
var repo_id = '{{ . | safeJS }}';
|
|
{
|
|
{ else
|
|
}
|
|
}
|
|
var base_url = '';
|
|
var repo_id = '';
|
|
{
|
|
{
|
|
end
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<script javascripts src="{{ "/application.js" | absURL }}"></script>
|
|
{{ range .Site.Params.custom_js }}
|
|
<script src="{{ . | absURL }}"></script>
|
|
{{ end }}
|
|
|
|
<script>
|
|
{
|
|
{
|
|
"/* Add headers to scrollspy */" | safeJS
|
|
}
|
|
}
|
|
var headers = document.getElementsByTagName("h2");
|
|
var scrollspy = document.getElementById('scrollspy');
|
|
|
|
if (scrollspy) {
|
|
if (headers.length > 0) {
|
|
for (var i = 0; i < headers.length; i++) {
|
|
var li = document.createElement("li");
|
|
li.setAttribute("class", "anchor");
|
|
|
|
var a = document.createElement("a");
|
|
if (!headers[i].id)
|
|
a.setAttribute("href", headers[i].parentNode.href);
|
|
else
|
|
a.setAttribute("href", "#" + headers[i].id);
|
|
a.setAttribute("title", headers[i].innerHTML);
|
|
a.innerHTML = headers[i].innerHTML;
|
|
|
|
li.appendChild(a);
|
|
scrollspy.appendChild(li);
|
|
}
|
|
} else {
|
|
scrollspy.parentElement.removeChild(scrollspy)
|
|
}
|
|
|
|
|
|
{
|
|
{
|
|
"/* Add permanent link next to the headers */" | safeJS
|
|
}
|
|
}
|
|
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
|
|
|
|
for (var i = 0; i < headers.length; i++) {
|
|
var a = document.createElement("a");
|
|
a.setAttribute("class", "headerlink");
|
|
a.setAttribute("href", "#" + headers[i].id);
|
|
a.setAttribute("title", "Permanent link");
|
|
a.innerHTML = {
|
|
{
|
|
or.Site.Params.permalink
|
|
"¶"
|
|
}
|
|
}
|
|
;
|
|
headers[i].appendChild(a);
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
|
|
<script>hljs.initHighlightingOnLoad();</script>
|
|
</body>
|
|
</html>
|