swadhinbiswas π¨ docs: new webtui/ β from-scratch terminal docs site (WebTUI, 8-bit palette, dual sidebar, nerd icons, 5 themes) Β· 8/8/2026
74e99fc
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
// JustAPI Docs β terminal UI (pure JS, no framework)
(function () {
'use strict';
// βββ Theme switcher βββ
var THEMES = ['dark', 'light', 'catppuccin', 'everforest', 'nord'];
var ICONS = {
dark: '\uf1db', // nf-fa-moon
light: '\uf185', // nf-fa-sun
catppuccin: '\uf870', // nf-md-palette
everforest: '\uf1a0', // nf-fa-leaf
nord: '\uf0c8', // nf-fa-square
};
function applyTheme(t) {
document.documentElement.setAttribute('data-webtui-theme', t);
document.documentElement.setAttribute('data-theme', t);
try { localStorage.setItem('ja-theme', t); } catch (e) {}
document.querySelectorAll('.ja-theme-btn').forEach(function (b) {
b.classList.toggle('active', b.dataset.theme === t);
});
}
function initThemeSwitcher() {
var saved = null;
try { saved = localStorage.getItem('ja-theme'); } catch (e) {}
var w = document.getElementById('themeSwitcher');
if (!w) return;
THEMES.forEach(function (t) {
var b = document.createElement('button');
b.className = 'ja-theme-btn';
b.dataset.theme = t;
b.title = t;
b.setAttribute('aria-label', 'Theme: ' + t);
b.innerHTML = ICONS[t];
b.addEventListener('click', function () { applyTheme(t); });
w.appendChild(b);
});
applyTheme(saved && THEMES.indexOf(saved) !== -1 ? saved : 'catppuccin');
}
// βββ Terminal tabs βββ
function initTabs() {
document.querySelectorAll('.ja-tabs').forEach(function (tabs) {
var btns = tabs.querySelectorAll('[data-tab-btn]');
var panels = tabs.querySelectorAll('[data-tab-panel]');
btns.forEach(function (btn) {
btn.addEventListener('click', function () {
var target = btn.dataset.tabBtn;
btns.forEach(function (b) { b.setAttribute('data-active', b === btn ? 'true' : 'false'); });
panels.forEach(function (p) { p.style.display = p.dataset.tabPanel === target ? 'block' : 'none'; });
});
});
});
}
// βββ Benchmark bars βββ
function initBars() {
var bars = document.querySelectorAll('.ja-bar-fill');
if (!bars.length || !('IntersectionObserver' in window)) return;
var io = new IntersectionObserver(function (entries) {
entries.forEach(function (e) {
if (e.isIntersecting) {
e.target.style.width = e.target.getAttribute('data-w') || '0%';
io.unobserve(e.target);
}
});
}, { threshold: 0.4 });
bars.forEach(function (b) { io.observe(b); });
}
// βββ Sidebar active link + mobile toggle βββ
function initSidebar() {
var path = window.location.pathname;
document.querySelectorAll('.ja-nav-tree a').forEach(function (a) {
if (a.getAttribute('href') === path) a.classList.add('active');
});
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function () {
initThemeSwitcher();
initTabs();
initBars();
initSidebar();
});
} else {
initThemeSwitcher();
initTabs();
initBars();
initSidebar();
}
})();