hgfd
This commit is contained in:
@@ -1786,6 +1786,10 @@ window.cancelAnimFrame = (function () {
|
||||
|
||||
// ── Onara Alternative Flavor: Fullscreen Modal Wrapper ─────────────────────
|
||||
const isOnaraActive = () => {
|
||||
// Global config onara overweighs always the user pref
|
||||
if (window.f0ckSession && window.f0ckSession.onara_cfg !== undefined && window.f0ckSession.onara_cfg !== null) {
|
||||
return !!window.f0ckSession.onara_cfg;
|
||||
}
|
||||
const stored = (() => { try { return localStorage.getItem('f0ck_onara_enabled'); } catch { return null; } })();
|
||||
if (stored !== null) {
|
||||
const active = stored === 'true';
|
||||
|
||||
+26
-17
@@ -1586,29 +1586,38 @@
|
||||
};
|
||||
|
||||
|
||||
// Onara enable/disable toggle (localStorage only — no server round-trip needed)
|
||||
// Onara enable/disable toggle
|
||||
const onaraEnabledToggle = document.getElementById('onara_enabled_toggle');
|
||||
if (onaraEnabledToggle) {
|
||||
const LS_KEY = 'f0ck_onara_enabled';
|
||||
// Seed checkbox from localStorage; fall back to the server-set session value
|
||||
const stored = localStorage.getItem(LS_KEY);
|
||||
const sessionOnara = !!(window.f0ckSession?.onara);
|
||||
onaraEnabledToggle.checked = stored !== null ? stored === 'true' : sessionOnara;
|
||||
// Reflect current state into window.onara so isOnaraActive() sees it
|
||||
window.onara = onaraEnabledToggle.checked;
|
||||
try {
|
||||
document.cookie = `f0ck_onara=${onaraEnabledToggle.checked ? '1' : '0'}; path=/; max-age=31536000; SameSite=Lax`;
|
||||
} catch {}
|
||||
const hasGlobalConfig = window.f0ckSession && window.f0ckSession.onara_cfg !== undefined && window.f0ckSession.onara_cfg !== null;
|
||||
|
||||
onaraEnabledToggle.addEventListener('change', () => {
|
||||
const enabled = onaraEnabledToggle.checked;
|
||||
localStorage.setItem(LS_KEY, String(enabled));
|
||||
if (hasGlobalConfig) {
|
||||
const globalVal = !!window.f0ckSession.onara_cfg;
|
||||
onaraEnabledToggle.checked = globalVal;
|
||||
onaraEnabledToggle.disabled = true;
|
||||
window.onara = globalVal;
|
||||
} else {
|
||||
// Seed checkbox from localStorage; fall back to the server-set session value
|
||||
const stored = localStorage.getItem(LS_KEY);
|
||||
const sessionOnara = !!(window.f0ckSession?.onara);
|
||||
onaraEnabledToggle.checked = stored !== null ? stored === 'true' : sessionOnara;
|
||||
// Reflect current state into window.onara so isOnaraActive() sees it
|
||||
window.onara = onaraEnabledToggle.checked;
|
||||
try {
|
||||
document.cookie = `f0ck_onara=${enabled ? '1' : '0'}; path=/; max-age=31536000; SameSite=Lax`;
|
||||
document.cookie = `f0ck_onara=${onaraEnabledToggle.checked ? '1' : '0'}; path=/; max-age=31536000; SameSite=Lax`;
|
||||
} catch {}
|
||||
window.onara = enabled;
|
||||
showStatus('Onara viewer ' + (enabled ? 'enabled' : 'disabled') + '.', 'success');
|
||||
});
|
||||
|
||||
onaraEnabledToggle.addEventListener('change', () => {
|
||||
const enabled = onaraEnabledToggle.checked;
|
||||
localStorage.setItem(LS_KEY, String(enabled));
|
||||
try {
|
||||
document.cookie = `f0ck_onara=${enabled ? '1' : '0'}; path=/; max-age=31536000; SameSite=Lax`;
|
||||
} catch {}
|
||||
window.onara = enabled;
|
||||
showStatus('Onara viewer ' + (enabled ? 'enabled' : 'disabled') + '.', 'success');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Quote Emojis Toggle
|
||||
|
||||
Reference in New Issue
Block a user