Auto commit: 2026-02-16T22:46:31.666Z
This commit is contained in:
parent
75595aef15
commit
1151eb2fd7
195
index.php
195
index.php
@ -686,6 +686,66 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
/* Sleep Timer Modal */
|
||||
.sleep-modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
z-index: 3000;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0,0,0,0.7);
|
||||
backdrop-filter: blur(10px);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
.sleep-modal.show {
|
||||
display: flex;
|
||||
opacity: 1;
|
||||
}
|
||||
.sleep-modal-content {
|
||||
background: rgba(20, 20, 20, 0.8);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
padding: 2.5rem;
|
||||
border-radius: 32px;
|
||||
width: 90%;
|
||||
max-width: 400px;
|
||||
text-align: center;
|
||||
transform: scale(0.8);
|
||||
transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||
box-shadow: 0 20px 60px rgba(0,0,0,0.5);
|
||||
}
|
||||
.sleep-modal.show .sleep-modal-content {
|
||||
transform: scale(1);
|
||||
}
|
||||
.sleep-option {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
color: white;
|
||||
padding: 1rem;
|
||||
margin: 0.8rem 0;
|
||||
border-radius: 16px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.sleep-option:hover {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
transform: translateY(-2px);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
.sleep-option.active {
|
||||
background: var(--primary-color);
|
||||
color: #000;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
.qr-modal-close {
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
@ -896,6 +956,20 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
|
||||
</button>
|
||||
<i class="bi bi-volume-up"></i>
|
||||
<input type="range" class="volume-slider" min="0" max="1" step="0.01" value="1" oninput="changeVolume(this.value)">
|
||||
<button id="sleep-timer-btn" onclick="openSleepModal()" style="background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: white; width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s;" title="Temporizador de apagado">
|
||||
<i class="bi bi-clock"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="sleep-countdown" style="display: none; text-align: center; margin-top: -0.5rem; font-size: 0.8rem; color: var(--accent-color); font-weight: bold; animation: fadeIn 0.5s;">
|
||||
Apagado en: <span id="sleep-time-left">00:00</span>
|
||||
</div>
|
||||
|
||||
<div id="upcoming-tracks-container" style="margin-top: 1.5rem; display: none; background: rgba(255, 255, 255, 0.02); padding: 1rem; border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.05);">
|
||||
<span class="track-label" style="font-size: 0.65rem; margin-bottom: 0.8rem; color: var(--primary-color);">
|
||||
<i class="bi bi-fast-forward-fill"></i> PRÓXIMAMENTE
|
||||
</span>
|
||||
<div id="upcoming-tracks-list" style="display: flex; flex-direction: column; gap: 0.6rem;"></div>
|
||||
</div>
|
||||
|
||||
<div id="recent-tracks-container" style="margin-top: 1rem; display: none;">
|
||||
@ -996,6 +1070,33 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Sleep Timer Modal -->
|
||||
<div id="sleep-modal" class="sleep-modal" onclick="closeSleepModal()">
|
||||
<div class="sleep-modal-content" onclick="event.stopPropagation()">
|
||||
<h3 style="margin-top: 0; color: var(--primary-color);">Temporizador</h3>
|
||||
<p style="opacity: 0.7; font-size: 0.9rem; margin-bottom: 1.5rem;">La radio se detendrá automáticamente.</p>
|
||||
|
||||
<div class="sleep-option" onclick="setSleepTimer(15)">
|
||||
<span>15 Minutos</span>
|
||||
<i class="bi bi-chevron-right"></i>
|
||||
</div>
|
||||
<div class="sleep-option" onclick="setSleepTimer(30)">
|
||||
<span>30 Minutos</span>
|
||||
<i class="bi bi-chevron-right"></i>
|
||||
</div>
|
||||
<div class="sleep-option" onclick="setSleepTimer(60)">
|
||||
<span>60 Minutos</span>
|
||||
<i class="bi bi-chevron-right"></i>
|
||||
</div>
|
||||
<div id="cancel-sleep-option" class="sleep-option" onclick="setSleepTimer(0)" style="margin-top: 2rem; border-color: #ff4444; color: #ff4444; display: none;">
|
||||
<span>Desactivar</span>
|
||||
<i class="bi bi-x-circle"></i>
|
||||
</div>
|
||||
|
||||
<button onclick="closeSleepModal()" style="margin-top: 1.5rem; background: none; border: none; color: white; opacity: 0.5; cursor: pointer;">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Floating Social Links -->
|
||||
<div class="social-float-container">
|
||||
<a href="<?= $facebook_link ?>" class="social-float facebook" target="_blank" title="Facebook">
|
||||
@ -1636,11 +1737,105 @@ $facebook_link = "https://www.facebook.com/profile.php?id=61587890927489";
|
||||
}
|
||||
}
|
||||
|
||||
// --- Sleep Timer & Upcoming Tracks ---
|
||||
let sleepTimeout = null;
|
||||
let sleepInterval = null;
|
||||
|
||||
function openSleepModal() {
|
||||
const modal = document.getElementById('sleep-modal');
|
||||
modal.style.display = 'flex';
|
||||
setTimeout(() => modal.classList.add('show'), 10);
|
||||
|
||||
// Show cancel option if active
|
||||
document.getElementById('cancel-sleep-option').style.display = sleepTimeout ? 'flex' : 'none';
|
||||
}
|
||||
|
||||
function closeSleepModal() {
|
||||
const modal = document.getElementById('sleep-modal');
|
||||
modal.classList.remove('show');
|
||||
setTimeout(() => modal.style.display = 'none', 300);
|
||||
}
|
||||
|
||||
function setSleepTimer(minutes) {
|
||||
// Clear existing
|
||||
if (sleepTimeout) clearTimeout(sleepTimeout);
|
||||
if (sleepInterval) clearInterval(sleepInterval);
|
||||
|
||||
if (minutes === 0) {
|
||||
document.getElementById('sleep-countdown').style.display = 'none';
|
||||
sleepTimeout = null;
|
||||
alert('Temporizador desactivado');
|
||||
closeSleepModal();
|
||||
return;
|
||||
}
|
||||
|
||||
const ms = minutes * 60 * 1000;
|
||||
const endTime = Date.now() + ms;
|
||||
|
||||
document.getElementById('sleep-countdown').style.display = 'block';
|
||||
|
||||
function updateCountdown() {
|
||||
const now = Date.now();
|
||||
const diff = endTime - now;
|
||||
if (diff <= 0) {
|
||||
clearInterval(sleepInterval);
|
||||
if (!audio.paused) togglePlay();
|
||||
document.getElementById('sleep-countdown').style.display = 'none';
|
||||
sleepTimeout = null;
|
||||
return;
|
||||
}
|
||||
const m = Math.floor(diff / 60000);
|
||||
const s = Math.floor((diff % 60000) / 1000);
|
||||
document.getElementById('sleep-time-left').innerText = `${m.toString().padStart(2, '0')}:${s.toString().padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
updateCountdown();
|
||||
sleepInterval = setInterval(updateCountdown, 1000);
|
||||
|
||||
sleepTimeout = setTimeout(() => {
|
||||
// Done
|
||||
}, ms);
|
||||
|
||||
alert(`La radio se apagará en ${minutes} minutos`);
|
||||
closeSleepModal();
|
||||
}
|
||||
|
||||
async function fetchUpcomingTracks() {
|
||||
try {
|
||||
// RadioKing API for next tracks
|
||||
const response = await fetch('https://www.radioking.com/widgets/api/v1/radio/828046/track/next?limit=3');
|
||||
const tracks = await response.json();
|
||||
|
||||
const container = document.getElementById('upcoming-tracks-container');
|
||||
const list = document.getElementById('upcoming-tracks-list');
|
||||
|
||||
if (tracks && tracks.length > 0) {
|
||||
container.style.display = 'block';
|
||||
list.innerHTML = tracks.map(track => `
|
||||
<div style="display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.03); padding: 8px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); transition: opacity 0.3s;">
|
||||
<img src="${track.cover || './assets/pasted-20260215-163754-def41f49.png'}" style="width: 35px; height: 35px; border-radius: 6px; object-fit: cover; box-shadow: 0 2px 5px rgba(0,0,0,0.2);">
|
||||
<div style="flex: 1; overflow: hidden;">
|
||||
<div style="font-size: 0.8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff;">${track.title}</div>
|
||||
<div style="font-size: 0.7rem; opacity: 0.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--primary-color);">${track.artist || 'Lili Records'}</div>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
} else {
|
||||
container.style.display = 'none';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching upcoming tracks:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// --- End Sleep Timer & Upcoming Tracks ---
|
||||
|
||||
// Fetch Now Playing Metadata from RadioKing
|
||||
let progressInterval = null;
|
||||
|
||||
async function updateMetadata() {
|
||||
try {
|
||||
fetchUpcomingTracks(); // Fetch next tracks in parallel
|
||||
const response = await fetch('https://www.radioking.com/widgets/api/v1/radio/828046/track/current');
|
||||
const data = await response.json();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user