Add ads system, diversify callers, update website descriptions
- Add ads playback system with backend endpoints and frontend UI - Diversify AI callers: randomize voices per session, expand jobs/problems/interests/quirks/locations - Update website tagline and descriptions to "biologically questionable organisms" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -81,6 +81,16 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Ads -->
|
||||
<section class="music-section">
|
||||
<h2>Ads</h2>
|
||||
<select id="ad-select"></select>
|
||||
<div class="music-controls">
|
||||
<button id="ad-play-btn">Play Ad</button>
|
||||
<button id="ad-stop-btn">Stop</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Sound Effects -->
|
||||
<section class="sounds-section">
|
||||
<h2>Sounds</h2>
|
||||
|
||||
@@ -38,6 +38,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
await loadAudioDevices();
|
||||
await loadCallers();
|
||||
await loadMusic();
|
||||
await loadAds();
|
||||
await loadSounds();
|
||||
await loadSettings();
|
||||
initEventListeners();
|
||||
@@ -119,6 +120,10 @@ function initEventListeners() {
|
||||
document.getElementById('stop-btn')?.addEventListener('click', stopMusic);
|
||||
document.getElementById('volume')?.addEventListener('input', setMusicVolume);
|
||||
|
||||
// Ads
|
||||
document.getElementById('ad-play-btn')?.addEventListener('click', playAd);
|
||||
document.getElementById('ad-stop-btn')?.addEventListener('click', stopMusic);
|
||||
|
||||
// Settings
|
||||
document.getElementById('settings-btn')?.addEventListener('click', async () => {
|
||||
document.getElementById('settings-modal')?.classList.remove('hidden');
|
||||
@@ -629,6 +634,50 @@ async function setMusicVolume(e) {
|
||||
}
|
||||
|
||||
|
||||
async function loadAds() {
|
||||
try {
|
||||
const res = await fetch('/api/ads');
|
||||
const data = await res.json();
|
||||
const ads = data.ads || [];
|
||||
|
||||
const select = document.getElementById('ad-select');
|
||||
if (!select) return;
|
||||
|
||||
const previousValue = select.value;
|
||||
select.innerHTML = '';
|
||||
|
||||
ads.forEach(ad => {
|
||||
const option = document.createElement('option');
|
||||
option.value = ad.file;
|
||||
option.textContent = ad.name;
|
||||
select.appendChild(option);
|
||||
});
|
||||
|
||||
if (previousValue && [...select.options].some(o => o.value === previousValue)) {
|
||||
select.value = previousValue;
|
||||
}
|
||||
|
||||
console.log('Loaded', ads.length, 'ads');
|
||||
} catch (err) {
|
||||
console.error('loadAds error:', err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function playAd() {
|
||||
await loadAds();
|
||||
const select = document.getElementById('ad-select');
|
||||
const track = select?.value;
|
||||
if (!track) return;
|
||||
|
||||
await fetch('/api/ads/play', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ track, action: 'play' })
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// --- Sound Effects (Server-Side) ---
|
||||
async function loadSounds() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user