mirror of
https://codeberg.org/Codeberg/Documentation.git
synced 2026-06-16 05:13:54 -07:00
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>
25 lines
810 B
JavaScript
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');
|
|
}
|
|
}
|