mirror of https://github.com/vacp2p/nim-libp2p.git
116 lines
3.2 KiB
INI
116 lines
3.2 KiB
INI
|
doc.item = """
|
||
|
<div id="$itemSymOrID" class="tohide">
|
||
|
<dt><pre>$header</pre></dt>
|
||
|
<dd>
|
||
|
$deprecationMsg
|
||
|
$desc
|
||
|
$seeSrc
|
||
|
</dd>
|
||
|
</div>
|
||
|
"""
|
||
|
|
||
|
doc.toc = """
|
||
|
<script type="text/javascript">
|
||
|
function main2() {
|
||
|
// Create the slider
|
||
|
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
|
||
|
var newSlider = document.createRange().createContextualFragment(`
|
||
|
<div class="theme-switch-wrapper">
|
||
|
<label class="theme-switch" for="internalcheckbox">
|
||
|
<input type="checkbox" id="internalcheckbox">
|
||
|
<div class="slider round"></div>
|
||
|
</label>
|
||
|
<em>Internal</em>
|
||
|
</div>
|
||
|
`);
|
||
|
|
||
|
var sliderInst = firstSlider.after(newSlider);
|
||
|
|
||
|
// Restore slider state from storage
|
||
|
var currentMode = localStorage.getItem('privateMode');
|
||
|
if (currentMode == "private") {
|
||
|
document.getElementById("internalcheckbox").checked = true;
|
||
|
} else {
|
||
|
hidePrivateProcs();
|
||
|
}
|
||
|
|
||
|
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
|
||
|
}
|
||
|
|
||
|
function hidePrivateProcs() {
|
||
|
var toHide = document.getElementsByClassName("tohide");
|
||
|
for (var i = 0; i < toHide.length; i++) {
|
||
|
var pragmas = toHide[i].querySelectorAll("span.Identifier");
|
||
|
var public = false;
|
||
|
for (var z = 0; z < pragmas.length; z++) {
|
||
|
if (pragmas[z].innerText == "public") {
|
||
|
public = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
if (public == false) {
|
||
|
toHide[i].style.display = "none";
|
||
|
toHide[i].classList.add("hidden");
|
||
|
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
|
||
|
for (var y = 0; y < links.length; y++) {
|
||
|
links[y].parentNode.style.display = "none";
|
||
|
links[y].parentNode.classList.add("hidden");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// TOC
|
||
|
var nestedSections = document.getElementsByClassName("nested-toc-section");
|
||
|
for (var i = 0; i < nestedSections.length; i++) {
|
||
|
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
|
||
|
nestedSections[i].style.display = "none";
|
||
|
nestedSections[i].classList.add("hidden");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var sections = document.getElementsByClassName("simple-toc-section");
|
||
|
for (var i = 0; i < sections.length; i++) {
|
||
|
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
|
||
|
sections[i].parentNode.style.display = "none";
|
||
|
sections[i].parentNode.classList.add("hidden");
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
// Sections
|
||
|
var sections = document.getElementsByClassName("section");
|
||
|
for (var i = 0; i < sections.length; i++) {
|
||
|
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
|
||
|
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
|
||
|
sections[i].style.display = "none";
|
||
|
sections[i].classList.add("hidden");
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function showPrivateProcs() {
|
||
|
var toHide = Array.from(document.getElementsByClassName("hidden"));
|
||
|
for (var i = 0; i < toHide.length; i++) {
|
||
|
toHide[i].style.display = "";
|
||
|
toHide[i].classList.remove("hidden");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function togglePrivateProcs() {
|
||
|
if (document.getElementById("internalcheckbox").checked) {
|
||
|
localStorage.setItem('privateMode', 'private');
|
||
|
showPrivateProcs();
|
||
|
} else {
|
||
|
localStorage.setItem('privateMode', 'public');
|
||
|
hidePrivateProcs();
|
||
|
}
|
||
|
}
|
||
|
window.addEventListener("DOMContentLoaded", main2);
|
||
|
</script>
|
||
|
<ul class="simple simple-toc" id="toc-list">
|
||
|
$content
|
||
|
</ul>
|
||
|
"""
|
||
|
|