mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 14:25:19 +00:00
refac: splash screen
This commit is contained in:
parent
40fc1a1f95
commit
1cc15e6470
1 changed files with 10 additions and 32 deletions
40
src/app.html
40
src/app.html
|
|
@ -33,6 +33,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
|
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
|
||||||
(() => {
|
(() => {
|
||||||
const metaThemeColorTag = document.querySelector('meta[name="theme-color"]');
|
const metaThemeColorTag = document.querySelector('meta[name="theme-color"]');
|
||||||
|
|
@ -77,28 +78,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function setSplashImage() {
|
|
||||||
const logo = document.getElementById('logo');
|
|
||||||
const isDarkMode = document.documentElement.classList.contains('dark');
|
const isDarkMode = document.documentElement.classList.contains('dark');
|
||||||
|
|
||||||
if (isDarkMode) {
|
const logo = document.createElement('img');
|
||||||
const darkImage = new Image();
|
logo.id = 'logo';
|
||||||
darkImage.src = '/static/splash-dark.png';
|
logo.style = "position: absolute; width: auto; height: 6rem; top: 44%; left: 50%; transform: translateX(-50%); display:block;";
|
||||||
|
logo.src = isDarkMode ? '/static/splash-dark.png' : '/static/splash.png';
|
||||||
|
|
||||||
darkImage.onload = () => {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
logo.src = '/static/splash-dark.png';
|
const splash = document.getElementById('splash-screen');
|
||||||
logo.style.filter = ''; // Ensure no inversion is applied if splash-dark.png exists
|
if (splash) splash.prepend(logo);
|
||||||
};
|
});
|
||||||
|
|
||||||
darkImage.onerror = () => {
|
|
||||||
logo.style.filter = 'invert(1)'; // Invert image if splash-dark.png is missing
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Runs after classes are assigned
|
|
||||||
window.onload = setSplashImage;
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -120,18 +110,6 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<img
|
|
||||||
id="logo"
|
|
||||||
style="
|
|
||||||
position: absolute;
|
|
||||||
width: auto;
|
|
||||||
height: 6rem;
|
|
||||||
top: 44%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
"
|
|
||||||
src="/static/splash.png"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style="
|
style="
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue