HEX
Server: Apache
System: Linux srv4.garantili.com.tr 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: ekspardev (1006)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/ekspardev/public_html/tubisad/rapor/src/js/demo-theme.js
/**
 * demo-theme is specifically loaded right after the body and not deferred
 * to ensure we switch to the chosen dark/light theme as fast as possible.
 * This will prevent any flashes of the light theme (default) before switching.
 */

const themeStorageKey = 'tablerTheme'
const defaultTheme = 'light'
let selectedTheme

// https://stackoverflow.com/a/901144
const params = new Proxy(new URLSearchParams(window.location.search), {
	 get: (searchParams, prop) => searchParams.get(prop),
});

if (!!params.theme) {
	 localStorage.setItem(themeStorageKey, params.theme)
	 selectedTheme = params.theme
} else {
	 const storedTheme = localStorage.getItem(themeStorageKey)
	 selectedTheme = storedTheme ? storedTheme : defaultTheme
}

document.body.classList.remove('theme-dark', 'theme-light');
document.body.classList.add(`theme-${selectedTheme}`);