code cleanup
This commit is contained in:
parent
118693ff33
commit
bfdb46e803
102
docs/main.js
102
docs/main.js
@ -1,57 +1,57 @@
|
|||||||
function createMenu() {
|
function createMenu() {
|
||||||
var menu = [
|
var menu = [
|
||||||
[0, '', 'Documentation'],
|
[0, '', 'Documentation'],
|
||||||
[1, 'gettingstarted', 'Getting Started'],
|
[1, 'gettingstarted', 'Getting Started'],
|
||||||
[1, 'general', 'General'],
|
[1, 'general', 'General'],
|
||||||
[1, 'system', 'System'],
|
[1, 'system', 'System'],
|
||||||
[1, 'cpu', 'CPU'],
|
[1, 'cpu', 'CPU'],
|
||||||
[1, 'memory', 'Memory'],
|
[1, 'memory', 'Memory'],
|
||||||
[1, 'battery', 'Battery'],
|
[1, 'battery', 'Battery'],
|
||||||
[1, 'filesystem', 'Disks / FS'],
|
[1, 'filesystem', 'Disks / FS'],
|
||||||
[1, 'graphics', 'Graphics'],
|
[1, 'graphics', 'Graphics'],
|
||||||
[1, 'os', 'OS'],
|
[1, 'os', 'OS'],
|
||||||
[1, 'network', 'Network'],
|
[1, 'network', 'Network'],
|
||||||
[1, 'processes', 'Processes / Services'],
|
[1, 'processes', 'Processes / Services'],
|
||||||
[1, 'docker', 'Docker'],
|
[1, 'docker', 'Docker'],
|
||||||
[0, '', 'More'],
|
[0, '', 'More'],
|
||||||
[1, 'history', 'Version history'],
|
[1, 'history', 'Version history'],
|
||||||
[1, 'issues', 'Known Issues'],
|
[1, 'issues', 'Known Issues'],
|
||||||
[1, 'statsfunctions', 'Stats Functions'],
|
[1, 'statsfunctions', 'Stats Functions'],
|
||||||
[1, 'copyright', 'Copyright & License'],
|
[1, 'copyright', 'Copyright & License'],
|
||||||
[1, 'contributors', 'Contributors'],
|
[1, 'contributors', 'Contributors'],
|
||||||
[1, 'trademarks', 'Trademarks'],
|
[1, 'trademarks', 'Trademarks'],
|
||||||
];
|
];
|
||||||
|
|
||||||
var path = window.location.pathname;
|
var path = window.location.pathname;
|
||||||
var page = path.split("/").pop().replace('.html', '');
|
var page = path.split('/').pop().replace('.html', '');
|
||||||
|
|
||||||
var menuParent = document.getElementById('menu');
|
var menuParent = document.getElementById('menu');
|
||||||
var titleElement;
|
var titleElement;
|
||||||
var ulElement;
|
var ulElement;
|
||||||
var hrElement;
|
var hrElement;
|
||||||
var liElement;
|
var liElement;
|
||||||
var aElement;
|
var aElement;
|
||||||
for (let item of menu) {
|
for (let item of menu) {
|
||||||
if (item[0] === 0) {
|
if (item[0] === 0) {
|
||||||
titleElement = document.createElement('div');
|
titleElement = document.createElement('div');
|
||||||
titleElement.classList.add("title");
|
titleElement.classList.add('title');
|
||||||
titleElement.innerText = item[2];
|
titleElement.innerText = item[2];
|
||||||
menuParent.appendChild(titleElement);
|
menuParent.appendChild(titleElement);
|
||||||
hrElement = document.createElement('hr');
|
hrElement = document.createElement('hr');
|
||||||
titleElement.appendChild(hrElement);
|
titleElement.appendChild(hrElement);
|
||||||
ulElement = document.createElement('ul');
|
ulElement = document.createElement('ul');
|
||||||
titleElement.appendChild(ulElement);
|
titleElement.appendChild(ulElement);
|
||||||
} else {
|
} else {
|
||||||
liElement = document.createElement('li');
|
liElement = document.createElement('li');
|
||||||
if (page === item[1]) {
|
if (page === item[1]) {
|
||||||
liElement.classList.add("active");
|
liElement.classList.add('active');
|
||||||
}
|
}
|
||||||
aElement = document.createElement('a');
|
aElement = document.createElement('a');
|
||||||
aElement.setAttribute('href', item[1] + '.html');
|
aElement.setAttribute('href', item[1] + '.html');
|
||||||
aElement.innerText = item[2];
|
aElement.innerText = item[2];
|
||||||
ulElement.appendChild(liElement);
|
ulElement.appendChild(liElement);
|
||||||
liElement.appendChild(aElement);
|
liElement.appendChild(aElement);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user