// Arching Kaos Dentralized Radio // // Kaotisk Hund - 2024 // // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0 // // var radio = document.querySelector("#radio-player"); // var radioButton = document.querySelector("#radio-button-controller"); if (radio !== null ) { radio.addEventListener("play", ()=>{ radioButton.innerHTML = ' '; }) radio.addEventListener("pause", ()=>{ radioButton.innerHTML = ' '; }) } var played = []; var list = mixtapeIds; var currentPlaying = 0; function radioLoad() { if (radio !== null ) { var elem = document.querySelector('#'+mixtapeIds[0]).firstChild.cloneNode(true); currentPlaying = 0; radio.appendChild(elem); radio.play(); } } function radioLoadNextAndPlay() { if (radio !== null ) { currentPlaying += 1; radio.removeChild(radio.firstChild); var elem = document.querySelector('#'+mixtapeIds[currentPlaying]).firstChild.cloneNode(true); if ( elem !== null ) { radio.appendChild(elem); radio.load(); radio.play(); } else { radioLoad(); } } } if ( radio !== null ) { radio.addEventListener("ended", radioLoadNextAndPlay); } function radioToggle() { if ( radio !== null ) { if (radio.paused) { radio.play(); } else { radio.pause(); } } } // vim: tabstop=4 shiftwidth=4 expandtab softtabstop=4 // @license-end