-
Notifications
You must be signed in to change notification settings - Fork 4
/
publish.js
23 lines (20 loc) · 929 Bytes
/
publish.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var siteLeft = document.querySelector('.site-body-left-column');
let navOrderAsc = ["welcome.md", "start here.md"]; /* these go on top*/
let navOrderDsc = []; /* these go at the bottom */
/* items not mentioned go in between in alphabetical order */
var siteNav = siteLeft.querySelector('.nav-view-outer');
var navContainer = siteNav.querySelector('.tree-item').querySelector('.tree-item-children');
for (const item of navOrderAsc.reverse()){
querytext = '[data-path="' + item + '"]';
navItem = navContainer.querySelector(querytext);
if (navItem == null) continue;
moveItem = navItem.parentElement;
navContainer.prepend(moveItem);
}
for (const item of navOrderDsc.reverse()){
querytext = '[data-path="' + item + '"]';
navItem = navContainer.querySelector(querytext);
if (navItem == null) continue;
moveItem = navItem.parentElement;
navContainer.append(moveItem);
}