xiaozhi-esp32-server/main/digital-human/js/ui/background-load.js
lapy a5db8f8b11 merge: integrate downstream westernization onto upstream/main
Merge 154 upstream commits with the 12-commit westernization stack,
preserving upstream features (theme refactor, knowledge base, device
calling, web search) while keeping downstream provider policy, English
defaults, and westernized surfaces.
2026-06-13 11:22:28 +01:00

27 lines
851 B
JavaScript

// Background image load check.
(function() {
const backgroundContainer = document.getElementById('backgroundContainer');
// Extract the background image URL.
let bgImageUrl = window.getComputedStyle(backgroundContainer).backgroundImage;
const urlMatch = bgImageUrl && bgImageUrl.match(/url\(["']?(.*?)["']?\)/);
if (!urlMatch || !urlMatch[1]) {
console.warn('Could not extract a valid background image URL.');
return;
}
bgImageUrl = urlMatch[1];
const bgImage = new Image();
bgImage.onerror = function() {
console.error('Failed to load the background image:', bgImageUrl);
};
// Show the model loading indicator once the background is ready.
bgImage.onload = function() {
modelLoading.style.display = 'flex';
};
bgImage.src = bgImageUrl;
})();