$(document).ready(function () { if ("serviceWorker" in navigator) { navigator.serviceWorker.register(`${ui.baseurl}/sw.caches.js`); } else { debug("Service Worker not supported!"); } function debug() { console.debug.apply(console, arguments); } let analytics = new URL( `https://rundocs-analytics.glitch.me/collect?v=${ui.version}&lang=${ui.lang}` ); analytics.searchParams.append("user_lang", navigator.language); analytics.searchParams.append("host", location.host); analytics.searchParams.append("platform", navigator.platform); $.getJSON(analytics.toString(), (data) => $("#counter").html(data.count)); function initialize(name) { let link = $(".toctree").find(`[href="${decodeURI(name)}"]`); if (link.length > 0) { $(".toctree .current").removeClass("current"); link.addClass("current"); link.closest(".level-1").parent().addClass("current"); for (let i = 1; i <= 11; i++) { link.closest(`.level-${i}`).addClass("current"); } /* need debug */ $(".toctree a") .children("span") .html(``); $(".toctree a.current") .children("span") .html(``); } // if(/^#/.test(name) && $(name).length >0){ // $(name)[0].scrollIntoView(); // } } function toggleCurrent(link) { let closest = link.closest("li"); closest.siblings("li.current").removeClass("current"); closest.siblings().find("li.current").removeClass("current"); closest.find("> ul li.current").removeClass("current"); closest.toggleClass("current"); } function toc() { $(".toctree li.current") .append('') .html(function () { let level = parseInt(this.dataset.level); let temp = 0; let stack = [$(this).find(".content-toc")]; $(".markdown-body") .find("h2,h3,h4,h5,h6") .each(function () { let anchor = $("") .addClass("d-flex") .text($(this).text()) .attr("href", `#${this.id}`); let tagLevel = parseInt(this.tagName.slice(1)) - 1; if (tagLevel > temp) { let parent = stack[0].children("li:last")[0]; if (parent) { stack.unshift($("