refac
This commit is contained in:
1 parent
bc8d24c951
commit
704d07e9a2
1 file changed
+1
-29
@@ -2,40 +2,12 @@
|
|||||||
import { getContext } from 'svelte';
|
import { getContext } from 'svelte';
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
import { WEBUI_BASE_URL } from '$lib/constants';
|
|
||||||
|
|
||||||
export let show = true;
|
export let show = true;
|
||||||
export let getStartedHandler = () => {};
|
export let getStartedHandler = () => {};
|
||||||
|
|
||||||
let videoElement;
|
let videoElement;
|
||||||
let playOnInteractionRegistered = false;
|
let playOnInteractionRegistered = false;
|
||||||
|
|
||||||
function setLogoImage() {
|
|
||||||
const logo = document.getElementById('logo');
|
|
||||||
|
|
||||||
if (logo) {
|
|
||||||
const isDarkMode = document.documentElement.classList.contains('dark');
|
|
||||||
|
|
||||||
if (isDarkMode) {
|
|
||||||
const darkImage = new Image();
|
|
||||||
darkImage.src = `${WEBUI_BASE_URL}/static/favicon-dark.png`;
|
|
||||||
|
|
||||||
darkImage.onload = () => {
|
|
||||||
logo.src = `${WEBUI_BASE_URL}/static/favicon-dark.png`;
|
|
||||||
logo.style.filter = ''; // Ensure no inversion is applied if splash-dark.png exists
|
|
||||||
};
|
|
||||||
|
|
||||||
darkImage.onerror = () => {
|
|
||||||
logo.style.filter = 'invert(1)'; // Invert image if splash-dark.png is missing
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$: if (show) {
|
|
||||||
setLogoImage();
|
|
||||||
}
|
|
||||||
|
|
||||||
function playBackgroundVideo() {
|
function playBackgroundVideo() {
|
||||||
if (!videoElement) {
|
if (!videoElement) {
|
||||||
return;
|
return;
|
||||||
@@ -71,7 +43,7 @@
|
|||||||
<img
|
<img
|
||||||
id="logo"
|
id="logo"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
src="{WEBUI_BASE_URL}/static/favicon.png"
|
src="/static/favicon.png"
|
||||||
class="size-6 rounded-full"
|
class="size-6 rounded-full"
|
||||||
alt="logo"
|
alt="logo"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user