-
Notifications
You must be signed in to change notification settings - Fork 55
/
nimdoc.cfg
115 lines (102 loc) · 3.16 KB
/
nimdoc.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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>
"""