2020-01-24 12:47:52 -07:00
|
|
|
$(function() {
|
|
|
|
function hasPrefix(str, prefix) {
|
|
|
|
if (!prefix) return true;
|
|
|
|
if (!str) return false;
|
|
|
|
return str.indexOf(prefix) === 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// highlight current page in left nav
|
|
|
|
var $currentPageLink = $('main nav a[href="'+window.location.pathname+'"]');
|
|
|
|
if (hasPrefix(window.location.pathname, "/docs/json/")) {
|
|
|
|
// as a special case, highlight the JSON structure link anywhere within it
|
|
|
|
$currentPageLink = $('main nav a[href="/docs/json/"]');
|
|
|
|
}
|
|
|
|
$currentPageLink.addClass('current');
|
2020-02-26 16:30:54 -05:00
|
|
|
|
|
|
|
// add anchor links, inspired by https://github.com/bryanbraun/anchorjs
|
|
|
|
$('article h1[id],h2[id],h3[id],h4[id],h5[id],h6[id]').each(function() {
|
|
|
|
$(this).append($('<a href="#'+this.id+'" class="anchor-link" aria-label="Anchor"></a>'));
|
|
|
|
});
|
2020-01-24 12:47:52 -07:00
|
|
|
});
|