mirror of
https://github.com/aljazceru/twentyone-world.github.io.git
synced 2025-12-22 04:54:19 +01:00
120 lines
2.9 KiB
HTML
120 lines
2.9 KiB
HTML
---
|
|
class: docs
|
|
layout: default
|
|
toc: true
|
|
styles: ['/js/highlight/styles/github.css']
|
|
---
|
|
<script type="text/javascript" src="/js/jquery.min.js"></script>
|
|
<script type="text/javascript" src="/js/highlight/highlight.pack.js"></script>
|
|
|
|
<div class="alert">
|
|
Writing documentation (and keeping it up to date) is a lot of work. <b>You can help</b> improving it by <a href="https://github.com/kartograph/kartograph.org/issues/new">submitting any bug</a> you encounter, or, even better, directly patching
|
|
<a href="https://github.com/kartograph/kartograph.org/blob/master{{ page.url | replace:'html','md' }}">this page on Github</a>. Thanks!
|
|
</div>
|
|
|
|
{{ content }}
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(function() {
|
|
var toc = $('.toc');
|
|
var ul = $('<ul></ul>'),
|
|
parent = ul;
|
|
|
|
toc.append(ul);
|
|
|
|
$('.docs h2, .docs h3').each(function(i, el) {
|
|
var h = $(el),
|
|
t = h.text(),
|
|
id = t.toLowerCase().replace(/[\s\.\:]+/g, '-'),
|
|
li = $('<li><a href="#'+id+'">'+t+'</a></li>');
|
|
|
|
h.append('<a class="headerlink" id="'+id+'" href="#'+id+'">¶</a>');
|
|
if (el.nodeName.toLowerCase() == 'h2') {
|
|
// parent = $('<ul></ul>');
|
|
// li.append(parent);
|
|
$(el).data('id', id);
|
|
$(li).data('id', id);
|
|
ul.append(li);
|
|
} else {
|
|
// parent.append(li);
|
|
}
|
|
});
|
|
|
|
$('.docs p').each(function(i, el) {
|
|
el = $(el);
|
|
if (el.html().substr(0,7) == 'Source:') {
|
|
el.addClass('source');
|
|
}
|
|
});
|
|
|
|
if (location.hash[0] == '#' && $(location.hash)) {
|
|
$(location.hash).parent()[0].scrollIntoView();
|
|
}
|
|
|
|
var tocTop = $('.toc').offset().top, tocTimeout;
|
|
|
|
function moveTOC() {
|
|
if (window.innerWidth < 780) return;
|
|
var sy = $(document).scrollTop(),
|
|
top = sy > 1000 ? sy - tocTop + 30 : 0;
|
|
$('.toc').css({
|
|
position: 'relative',
|
|
top: top
|
|
});
|
|
}
|
|
|
|
function highlightSection() {
|
|
$('.toc li').removeClass('active');
|
|
var m = null, sy = $(document).scrollTop();
|
|
$('.content h2').each(function(i, el) {
|
|
if (Math.round($(el).offset().top) <= sy) m = $(el);
|
|
});
|
|
$('.toc li').each(function(i, el) {
|
|
if ($(el).data('id') == m.data('id')) {
|
|
$(el).addClass('active');
|
|
return false;
|
|
}
|
|
});
|
|
}
|
|
|
|
$(window).scroll(function() {
|
|
if (tocTimeout) clearTimeout(tocTimeout);
|
|
if ($(document).scrollTop() < 1000) {
|
|
$('.toc').css('top', 0);
|
|
} else {
|
|
tocTimeout = setTimeout(moveTOC, 3000);
|
|
}
|
|
highlightSection();
|
|
});
|
|
|
|
moveTOC();
|
|
highlightSection();
|
|
|
|
});
|
|
|
|
$('pre code').each(function(i, e) {
|
|
var code = $(e).html().trim(),
|
|
code2 = code.replace(/\s/g, ''),
|
|
last = code2.substr(code2.length-1, 1);
|
|
|
|
if (code.substr(0,1) == '"' && (last == '}' || last == ']')) {
|
|
e.className = 'json';
|
|
$(e).html('{'+code+'}');
|
|
hljs.highlightBlock(e);
|
|
var i = $(e).html()
|
|
$(e).html(i.substr(1, i.length-2));
|
|
return;
|
|
} else if (last == ';') {
|
|
e.className = 'javascript';
|
|
}
|
|
|
|
hljs.highlightBlock(e)
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|