31 lines
1.2 KiB
Plaintext
31 lines
1.2 KiB
Plaintext
// Varaverk — shared JS utilities
|
|
// Page-specific JS lives inline in each page partial.
|
|
|
|
// Flash a status element briefly then fade
|
|
function vvFlashStatus(el, msg, ok) {
|
|
el.textContent = msg;
|
|
el.style.color = ok ? '#4caf50' : '#f44336';
|
|
setTimeout(() => { el.textContent = ''; }, 3000);
|
|
}
|
|
|
|
// ── Fullscreen toggle — hides Unraid header + menu ────────────────────────────
|
|
function vvToggleExpand() {
|
|
const on = document.body.classList.toggle('vv-fullscreen');
|
|
const btn = document.getElementById('vv-expand-btn');
|
|
if (btn) { btn.classList.toggle('active', on); btn.title = on ? 'Collapse' : 'Expand'; }
|
|
localStorage.setItem('vv-fullscreen', on ? '1' : '');
|
|
}
|
|
|
|
// Restore state on every page load
|
|
(function() {
|
|
if (localStorage.getItem('vv-fullscreen') !== '1') return;
|
|
document.body.classList.add('vv-fullscreen');
|
|
// Button may not exist yet if script runs before DOM — wait for it
|
|
const apply = () => {
|
|
const btn = document.getElementById('vv-expand-btn');
|
|
if (btn) { btn.classList.add('active'); btn.title = 'Collapse'; }
|
|
};
|
|
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', apply);
|
|
else apply();
|
|
})();
|