@@ -1931,26 +1966,6 @@ $twitter_link = "https://twitter.com/";
PETICIONES EN VIVO
-
No hay peticiones recientes.
@@ -2886,6 +2901,71 @@ $twitter_link = "https://twitter.com/";
// --- End Chat Functionality ---
// --- Song Request Functionality ---
+ async function submitSongRequestNew() {
+ const artistInput = document.getElementById('req-artist-new');
+ const songInput = document.getElementById('req-song-new');
+ const artist = artistInput.value.trim();
+ const song = songInput.value.trim();
+ const requester = document.getElementById('user-name').value.trim() || 'Anónimo';
+
+ if (!artist || !song) {
+ alert('Por favor, ingresa el artista y el nombre de la canción o saludo.');
+ if (!artist) artistInput.style.borderColor = '#ff4444';
+ if (!song) songInput.style.borderColor = '#ff4444';
+ return;
+ }
+
+ const btn = document.getElementById('submit-req-btn-new');
+ const originalContent = btn.innerHTML;
+ btn.disabled = true;
+ btn.innerHTML = '
PROCESANDO...';
+
+ try {
+ const formData = new FormData();
+ formData.append('artist', artist);
+ formData.append('song', song);
+ formData.append('requester', requester);
+ formData.append('source', 'web_dedicated');
+
+ const response = await fetch('api/song_requests.php', {
+ method: 'POST',
+ body: formData
+ });
+ const result = await response.json();
+ if (result.success) {
+ artistInput.value = '';
+ songInput.value = '';
+ artistInput.style.borderColor = '';
+ songInput.style.borderColor = '';
+
+ if (typeof fetchSongRequests === 'function') fetchSongRequests();
+
+ btn.innerHTML = '
¡ENVIADO CON ÉXITO!';
+ btn.style.backgroundColor = 'var(--accent-color)';
+
+ confetti({
+ particleCount: 150,
+ spread: 70,
+ origin: { y: 0.6 }
+ });
+
+ setTimeout(() => {
+ btn.disabled = false;
+ btn.innerHTML = originalContent;
+ btn.style.backgroundColor = '';
+ }, 3000);
+ } else {
+ alert('Error: ' + (result.error || 'No se pudo enviar la petición'));
+ btn.disabled = false;
+ btn.innerHTML = originalContent;
+ }
+ } catch (error) {
+ console.error('Error submitting request:', error);
+ btn.disabled = false;
+ btn.innerHTML = originalContent;
+ }
+ }
+
async function fetchSongRequests() {
try {
const response = await fetch('api/song_requests.php');
@@ -3679,6 +3759,7 @@ $twitter_link = "https://twitter.com/";
const currentTheme = body.getAttribute('data-theme');
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
const themeBtn = document.getElementById('theme-toggle').querySelector('i');
+ const switchDot = document.getElementById('theme-switch-dot');
body.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
@@ -3686,20 +3767,26 @@ $twitter_link = "https://twitter.com/";
if (newTheme === 'light') {
themeBtn.classList.remove('bi-moon-fill');
themeBtn.classList.add('bi-sun-fill');
+ if (switchDot) switchDot.style.left = '2px';
} else {
themeBtn.classList.remove('bi-sun-fill');
themeBtn.classList.add('bi-moon-fill');
+ if (switchDot) switchDot.style.left = '22px';
}
}
// Initialize Theme
(function() {
const savedTheme = localStorage.getItem('theme') || 'dark';
+ const switchDot = document.getElementById('theme-switch-dot');
if (savedTheme === 'light') {
document.body.setAttribute('data-theme', 'light');
const themeBtn = document.getElementById('theme-toggle').querySelector('i');
themeBtn.classList.remove('bi-moon-fill');
themeBtn.classList.add('bi-sun-fill');
+ if (switchDot) switchDot.style.left = '2px';
+ } else {
+ if (switchDot) switchDot.style.left = '22px';
}
// Welcome logic for new users