let playing = false; const radio = document.getElementById('radio'); const button = document.getElementById('radio-btn'); const trackInfo = document.getElementById('track-info'); const volumeSlider = document.getElementById('volume'); function toggleRadio() { if (playing) { radio.pause(); button.innerText = '▶ Ambient radio'; } else { radio.src = "https://ice2.somafm.com/deepspaceone-128-mp3"; radio.volume = parseFloat(volumeSlider.value); radio.play().then(() => { button.innerText = '⏸ Pause'; }).catch(err => { console.error("wait a bit:", err); trackInfo.innerText = "⚠️ Hmmm. oops."; }); } playing = !playing; } button.addEventListener('click', toggleRadio); volumeSlider.addEventListener('input', () => { radio.volume = parseFloat(volumeSlider.value); }); async function updateTrackInfo() { try { const res = await fetch("https://api.somafm.com/channels.json"); const json = await res.json(); const channel = json.channels.find(c => c.id === 'deepspaceone'); const title = channel?.lastPlaying || "Неизвестно"; trackInfo.innerText = title; } catch (err) { trackInfo.innerText = "whaat.."; } } setInterval(updateTrackInfo, 10000); updateTrackInfo();
photography / fine art / ai
Walter limo
portraits ➸
document.addEventListener("DOMContentLoaded", function() { const photosSection = document.querySelector('.photos-section'); const headerSection = document.querySelector('.header-section'); const body = document.body; window.addEventListener('scroll', () => { const photosSectionTop = photosSection.offsetTop; const headerSectionTop = headerSection.offsetTop; // Когда прокручиваем в область с фотографиями if (window.scrollY >= photosSectionTop && window.scrollY < headerSectionTop) { body.style.backgroundImage = 'url("https://example.com/photo1.jpg")'; // Фото для области с фотографиями } // Когда находимся в шапке else if (window.scrollY < headerSectionTop) { body.style.backgroundImage = 'url("https://example.com/photo2.jpg")'; // Фото для шапки } }); });