ai generated solutions to our ai generated problems
This commit is contained in:
@@ -12,6 +12,46 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="theme-color" content="#e82517" />
|
||||
<script>
|
||||
(() => {
|
||||
const cookies = Object.fromEntries(
|
||||
document.cookie.split('; ').filter(Boolean).map((item) => {
|
||||
const separator = item.indexOf('=')
|
||||
const key = separator === -1 ? item : item.slice(0, separator)
|
||||
const value = separator === -1 ? '' : item.slice(separator + 1)
|
||||
try {
|
||||
return [decodeURIComponent(key), decodeURIComponent(value)]
|
||||
} catch {
|
||||
return [key, value]
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
let theme = cookies['tssbot_theme']
|
||||
if (!theme) {
|
||||
try {
|
||||
theme = localStorage.getItem('tssbot.theme')
|
||||
} catch {}
|
||||
}
|
||||
theme = theme === 'dark' ? 'dark' : 'light'
|
||||
|
||||
let analyticsPreferences = null
|
||||
const serializedPreferences = cookies['tssbot_analytics_preferences']
|
||||
try {
|
||||
analyticsPreferences = JSON.parse(
|
||||
serializedPreferences || localStorage.getItem('tssbot.analyticsPreferences') || 'null',
|
||||
)
|
||||
} catch {}
|
||||
|
||||
window.__TSS_BOOT_PREFERENCES__ = { analyticsPreferences, theme }
|
||||
document.documentElement.dataset.theme = theme
|
||||
document.documentElement.style.colorScheme = theme
|
||||
document.querySelector('meta[name="theme-color"]')?.setAttribute(
|
||||
'content',
|
||||
theme === 'dark' ? '#101211' : '#e82517',
|
||||
)
|
||||
})()
|
||||
</script>
|
||||
<meta name="tss-turnstile-session" content="__TURNSTILE_SESSION__" />
|
||||
<meta
|
||||
name="description"
|
||||
|
||||
@@ -205,6 +205,9 @@ function normalizeThemePreference(value) {
|
||||
}
|
||||
|
||||
function storedThemePreference() {
|
||||
const bootTheme = window.__TSS_BOOT_PREFERENCES__?.theme
|
||||
if (bootTheme) return normalizeThemePreference(bootTheme)
|
||||
|
||||
const cookieValue = readCookie(themePreferenceCookie)
|
||||
if (cookieValue) return normalizeThemePreference(cookieValue)
|
||||
|
||||
@@ -229,6 +232,9 @@ function persistThemePreference(theme) {
|
||||
}
|
||||
|
||||
function storedAnalyticsPreferences() {
|
||||
const bootPreferences = window.__TSS_BOOT_PREFERENCES__?.analyticsPreferences
|
||||
if (bootPreferences) return normalizeAnalyticsPreferences(bootPreferences)
|
||||
|
||||
const cookieValue = readCookie(analyticsPreferencesCookie)
|
||||
if (cookieValue) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user