- Move mic-blocked warning into conv-chat-window (prepend) so it scrolls with the chat instead of pushing the input bar off-screen - Remove min-height:400px from conv-chat-window; give conv-chat-panel a viewport-relative height so the input bar is always visible at the bottom - loader.js: append ?v=<timestamp> to section fetches to bust browser cache (was serving stale s-conversation.html after updates) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
59 lines
2.1 KiB
JavaScript
59 lines
2.1 KiB
JavaScript
(async function () {
|
|
'use strict';
|
|
|
|
const SECTIONS = ['s-voices', 's-clone', 's-design', 's-studio', 's-tryout', 's-performance', 's-routing', 's-connect', 's-settings', 's-llms', 's-conversation'];
|
|
|
|
function loadScript(src) {
|
|
return new Promise(function (resolve, reject) {
|
|
var s = document.createElement('script');
|
|
s.src = src;
|
|
s.onload = resolve;
|
|
s.onerror = function () { reject(new Error('Failed to load ' + src)); };
|
|
document.body.appendChild(s);
|
|
});
|
|
}
|
|
|
|
// 1. Fetch all section partials in parallel and inject into their shells.
|
|
// ?v= busts the browser cache so updated HTML is always used.
|
|
var _v = Date.now();
|
|
await Promise.all(SECTIONS.map(async function (id) {
|
|
try {
|
|
var res = await fetch('/static/sections/' + id + '.html?v=' + _v);
|
|
if (!res.ok) throw new Error(res.status + ' ' + res.statusText);
|
|
var html = await res.text();
|
|
var el = document.getElementById(id);
|
|
if (el) el.innerHTML = html;
|
|
} catch (e) {
|
|
console.error('[loader] section', id, 'failed:', e.message);
|
|
var el = document.getElementById(id);
|
|
if (el) el.innerHTML = '<p style="color:var(--red);padding:24px">Failed to load section <b>' + id + '</b>: ' + e.message + '</p>';
|
|
}
|
|
}));
|
|
|
|
// 2. Load main application logic (runs init immediately on parse — sections must exist first)
|
|
const JS_MODULES = [
|
|
'/static/js/utils.js',
|
|
'/static/js/voice-inspector.js',
|
|
'/static/js/voice-sources.js',
|
|
'/static/js/integrations.js',
|
|
'/static/js/routing.js',
|
|
'/static/js/settings.js',
|
|
'/static/js/voice-clone.js',
|
|
'/static/js/voice-library.js',
|
|
'/static/js/tts-preview.js',
|
|
'/static/js/benchmark.js',
|
|
'/static/js/stt.js',
|
|
'/static/js/init.js',
|
|
'/static/js/engines.js',
|
|
'/static/js/ai-backends.js',
|
|
'/static/js/generation.js',
|
|
'/static/js/conversation.js',
|
|
];
|
|
for (const src of JS_MODULES) {
|
|
await loadScript(src);
|
|
}
|
|
|
|
// 3. Apply scroll-based navigation overrides (must run after app.js defines switchTab etc.)
|
|
await loadScript('/static/nav.js');
|
|
})();
|