Skip to content

Commit d01d3e8

Browse files
committed
js/docs.js: cleanup unused parts
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent e3e280c commit d01d3e8

File tree

2 files changed

+25
-82
lines changed

2 files changed

+25
-82
lines changed

components.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@ hide_from_sitemap: true
66

77
For components and controls we are using [Bootstrap](https://getbootstrap.com)
88

9-
10-
<!-- ### Dropdowns
11-
<div class="dropdown">
12-
<a id="dLabel" data-target="#" href="https://example.com" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
13-
Dropdown trigger
14-
<span class="caret"></span>
15-
</a>
16-
17-
<ul class="dropdown-menu" aria-labelledby="dLabel">
18-
...
19-
</ul>
20-
</div> -->
21-
229
### Tooltips
2310

2411
<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</button>

js/docs.js

Lines changed: 25 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,12 @@
1-
// Right nav highlighting
2-
var sidebarObj = (document.getElementsByClassName("sidebar")[0]) ? document.getElementsByClassName("sidebar")[0] : document.getElementsByClassName("sidebar-home")[0];
3-
4-
// ensure that the left nav visibly displays the current topic
5-
var current = document.getElementsByClassName("active currentPage");
6-
var body = document.getElementsByClassName("col-content content");
7-
if (current[0]) {
8-
if (sidebarObj) {
9-
current[0].scrollIntoView(true);
10-
body[0].scrollIntoView(true);
11-
}
12-
// library hack
13-
if (document.location.pathname.indexOf("/samples/") > -1) {
14-
$(".currentPage").closest("ul").addClass("in");
15-
}
16-
}
171

182
function navClicked(sourceLink) {
19-
var classString = document.getElementById("#item" + sourceLink).className;
20-
if (classString.indexOf(" in") > -1) {
21-
//collapse
22-
document.getElementById("#item" + sourceLink).className = classString.replace(" in", "");
23-
} else {
24-
//expand
25-
document.getElementById("#item" + sourceLink).className = classString.concat(" in");
3+
let el = document.getElementById("#item"+sourceLink)
4+
if (el) {
5+
el.classList.toggle("in")
266
}
277
}
288

29-
var outputLetNav = [];
30-
var totalTopics = 0;
9+
let outputLetNav = [], totalTopics = 0;
3110

3211
function pageIsInSection(tree) {
3312
function processBranch(branch) {
@@ -154,28 +133,6 @@ $(window).scroll(function () {
154133
}
155134
});
156135

157-
/*
158-
* toggle menu *****************************************************************
159-
*/
160-
161-
$("#menu-toggle").click(function (e) {
162-
e.preventDefault();
163-
$(".wrapper").toggleClass("right-open");
164-
$(".col-toc").toggleClass("col-toc-hidden");
165-
});
166-
167-
$("#menu-toggle-left").click(function (e) {
168-
e.preventDefault();
169-
$(".col-nav").toggleClass("col-toc-hidden");
170-
});
171-
172-
$(".navbar-toggle").click(function () {
173-
$("#sidebar-nav").each(function () {
174-
$(this).toggleClass("hidden-sm");
175-
$(this).toggleClass("hidden-xs");
176-
});
177-
});
178-
179136
var navHeight = $(".navbar").outerHeight(true) + 80;
180137

181138
$(document.body).scrollspy({
@@ -233,30 +190,29 @@ $(document).ready(function () {
233190
});
234191
});
235192

236-
/*
237-
* make dropdown show on hover *************************************************
238-
*/
239-
240-
$("ul.nav li.dropdown").hover(function () {
241-
$(this).find(".dropdown-menu").stop(true, true).delay(200).fadeIn(500);
242-
}, function () {
243-
$(this).find(".dropdown-menu").stop(true, true).delay(200).fadeOut(500);
244-
});
193+
function initNavToggle() {
194+
$("#menu-toggle").click(function (e) {
195+
e.preventDefault();
196+
$(".wrapper").toggleClass("right-open");
197+
$(".col-toc").toggleClass("col-toc-hidden");
198+
});
245199

246-
/*
247-
* Components ******************************************************************
248-
*/
200+
$(".navbar-toggle").click(function () {
201+
$("#sidebar-nav").each(function () {
202+
$(this).toggleClass("hidden-sm");
203+
$(this).toggleClass("hidden-xs");
204+
});
205+
});
206+
}
249207

250-
$(function () {
208+
ready(() => {
209+
renderNav()
210+
initNavToggle()
251211
$('[data-toggle="tooltip"]').tooltip()
252-
});
253212

254-
// sync tabs with the same data-group
255-
window.onload = function () {
256-
$(".nav-tabs > li > a").click(function (e) {
257-
var group = $(this).attr("data-group");
258-
$('.nav-tabs > li > a[data-group="' + group + '"]').tab("show");
213+
// sync tabs with the same data-group
214+
$(".nav-tabs > li > a").click(function () {
215+
const group = $(this).attr("data-group");
216+
$(`.nav-tabs > li > a[data-group='${ group }']`).tab("show");
259217
});
260-
};
261-
262-
ready(renderNav);
218+
});

0 commit comments

Comments
 (0)