tts-voice-creator-clone-and.../static/loader.js
mARTin-B78 28f5ec2e25 Redesign inspector pane, add searchable pickers, and style AI Backends tab
Inspector:
- Skinny 2-row header: 72px avatar + name/ID row / subtitle row / note row
- Searchable flag picker (dblclick flag icon) — filtered by voice language, falls back to ALL_FLAGS
- Searchable language picker (dblclick lang code) — shows full language names
- Tag reuse: entered tags persist to localStorage as datalist suggestions
- Compact active toggle (32×18px), slim save button (12px/4px padding)
- Show/hide eye toggle and "✓ Key saved" badge on API key fields

AI Backends (s-llms.html + style.css):
- Full CSS design: pill tabs with active accent, animated section transitions
- Service cards: icon bubbles, tier badges (Free/Demo/Paid), stat chips, endpoint rows, model tags
- Highlighted recommended card with accent border
- Dark code blocks for local service snippets with copy feedback
- Show/hide password toggle and auto-appearing "✓ Key saved" badge per card

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 11:23:27 +02:00

37 lines
1.4 KiB
JavaScript

(async function () {
'use strict';
const SECTIONS = ['s-voices', 's-clone', 's-design', 's-studio', 's-tryout', 's-routing', 's-connect', 's-settings', 's-llms'];
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
await Promise.all(SECTIONS.map(async function (id) {
try {
var res = await fetch('/static/sections/' + id + '.html');
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)
await loadScript('/static/app.js');
// 3. Apply scroll-based navigation overrides (must run after app.js defines switchTab etc.)
await loadScript('/static/nav.js');
})();