Documentation/assets/js/index.js
Gusted f564ca6cd2 Use Halfmoon v2 (#655)
Refresh Codeberg documentatation looks by using Halfmoon v2.

Mobile UI also got a overhaul.

Reviewed-on: https://codeberg.org/Codeberg/Documentation/pulls/655
Reviewed-by: Bastian Greshake Tzovaras <gedankenstuecke@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-08-12 17:53:32 +02:00

25 lines
810 B
JavaScript

if (localStorage.getItem('theme') === 'light') {
document.documentElement.setAttribute('data-bs-theme', 'light');
}
function toggleDarkMode() {
const rootPreference = document.documentElement.getAttribute('data-bs-theme');
if (rootPreference === 'light') {
document.documentElement.setAttribute('data-bs-theme', 'dark');
localStorage.setItem('theme', 'dark');
} else {
document.documentElement.setAttribute('data-bs-theme', 'light');
localStorage.setItem('theme', 'light');
}
}
function toggleSidebar() {
const sidebarEl = document.querySelector('.sidebar');
if (sidebarEl.classList.contains('show')) {
sidebarEl.classList.remove('show');
sidebarEl.classList.add('hiding');
} else {
sidebarEl.classList.remove('hiding');
sidebarEl.classList.add('show');
}
}