Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
a57586a2
"git@developer.sourcefind.cn:gaoqiong/pybind11.git" did not exist on "44e39e0de7ad011de9862a66666632401d66cdf3"
Commit
a57586a2
authored
Mar 17, 2024
by
Danny Liu
Browse files
use IIFE in app.html to prevent FOUC
parent
41cb6d7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
26 deletions
+28
-26
src/app.html
src/app.html
+28
-26
No files found.
src/app.html
View file @
a57586a2
...
...
@@ -8,34 +8,36 @@
<meta
name=
"robots"
content=
"noindex,nofollow"
/>
<script>
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
if
(
localStorage
.
theme
===
'
light
'
||
(
!
(
'
theme
'
in
localStorage
)
&&
window
.
matchMedia
(
'
(prefers-color-scheme: light)
'
).
matches
)
)
{
document
.
documentElement
.
classList
.
add
(
'
light
'
);
}
else
if
(
localStorage
.
theme
&&
localStorage
.
theme
!==
'
system
'
)
{
localStorage
.
theme
.
split
(
'
'
).
forEach
((
e
)
=>
{
document
.
documentElement
.
classList
.
add
(
e
);
});
}
else
if
(
localStorage
.
theme
&&
localStorage
.
theme
===
'
system
'
)
{
systemTheme
=
window
.
matchMedia
(
'
(prefers-color-scheme: dark)
'
).
matches
;
document
.
documentElement
.
classList
.
add
(
systemTheme
?
'
dark
'
:
'
light
'
);
}
else
{
document
.
documentElement
.
classList
.
add
(
'
dark
'
);
}
(()
=>
{
if
(
localStorage
.
theme
===
'
light
'
||
(
!
(
'
theme
'
in
localStorage
)
&&
window
.
matchMedia
(
'
(prefers-color-scheme: light)
'
).
matches
)
)
{
document
.
documentElement
.
classList
.
add
(
'
light
'
);
}
else
if
(
localStorage
.
theme
&&
localStorage
.
theme
!==
'
system
'
)
{
localStorage
.
theme
.
split
(
'
'
).
forEach
((
e
)
=>
{
document
.
documentElement
.
classList
.
add
(
e
);
});
}
else
if
(
localStorage
.
theme
&&
localStorage
.
theme
===
'
system
'
)
{
systemTheme
=
window
.
matchMedia
(
'
(prefers-color-scheme: dark)
'
).
matches
;
document
.
documentElement
.
classList
.
add
(
systemTheme
?
'
dark
'
:
'
light
'
);
}
else
{
document
.
documentElement
.
classList
.
add
(
'
dark
'
);
}
window
.
matchMedia
(
'
(prefers-color-scheme: dark)
'
).
addListener
((
e
)
=>
{
if
(
localStorage
.
theme
===
'
system
'
)
{
if
(
e
.
matches
)
{
document
.
documentElement
.
classList
.
add
(
'
dark
'
);
document
.
documentElement
.
classList
.
remove
(
'
light
'
);
}
else
{
document
.
documentElement
.
classList
.
add
(
'
light
'
);
document
.
documentElement
.
classList
.
remove
(
'
dark
'
);
window
.
matchMedia
(
'
(prefers-color-scheme: dark)
'
).
addListener
((
e
)
=>
{
if
(
localStorage
.
theme
===
'
system
'
)
{
if
(
e
.
matches
)
{
document
.
documentElement
.
classList
.
add
(
'
dark
'
);
document
.
documentElement
.
classList
.
remove
(
'
light
'
);
}
else
{
document
.
documentElement
.
classList
.
add
(
'
light
'
);
document
.
documentElement
.
classList
.
remove
(
'
dark
'
);
}
}
}
});
}
);
})
()
;
</script>
%sveltekit.head%
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment