1jQuery(function($){ 2 3 const audio = document.getElementById('radio-player'); 4 const playBtn = document.querySelector('.radio-play-btn'); 5 const pauseBtn = document.querySelector('.radio-pause-btn'); 6 7 if (!audio || !playBtn || !pauseBtn) { 8 console.error('Radio elements not found'); 9 return; 10 } 11 12 let isPlaying = false; 13 14 const firstSlide = document.querySelector('.radio-slide'); 15 16 let currentStream = firstSlide 17 ? firstSlide.dataset.stream 18 : ''; 19 20 if (currentStream) { 21 audio.src = currentStream; 22 } 23 24 const carousel = $('.radio-carousel'); 25 26 carousel.owlCarousel({ 27 items: 1, 28 loop: true, 29 dots: false, 30 nav: false, 31 margin: 10, 32 mouseDrag: true, 33 touchDrag: true 34 }); 35 36 $('.next-btn-radio').on('click', function(){ 37 carousel.trigger('next.owl.carousel'); 38 }); 39 40 $('.prev-btn-radio').on('click', function(){ 41 carousel.trigger('prev.owl.carousel'); 42 }); 43 44 function changeStation(stream) { 45 46 if (!stream) { 47 return; 48 } 49 50 currentStream = stream; 51 52 console.log('Changing station:', currentStream); 53 54 if (!isPlaying) { 55 audio.src = currentStream; 56 return; 57 } 58 59 // ΣÏαμάÏα ενÏελÏÏ Ïο ÏÏοηγοÏμενο stream 60 audio.pause(); 61 62 // ÎαθάÏιÏε Ïο source 63 audio.removeAttribute('src'); 64 audio.load(); 65 66 // ΦÏÏÏÏÏε Ïο νÎο 67 setTimeout(function(){ 68 69 audio.src = currentStream; 70 71 audio.play() 72 .then(function(){ 73 console.log('Now playing:', currentStream); 74 }) 75 .catch(function(error){ 76 console.error('Play error:', error); 77 }); 78 79 }, 200); 80 } 81 82 carousel.on('changed.owl.carousel', function(event){ 83 84 const slide = $(event.target) 85 .find('.owl-item') 86 .eq(event.item.index) 87 .find('.radio-slide'); 88 89 const stream = slide.data('stream'); 90 91 changeStation(stream); 92 93 }); 94 95 playBtn.addEventListener('click', function(){ 96 97 if (!currentStream) { 98 console.error('No stream found'); 99 return; 100 } 101 102 audio.src = currentStream; 103 104 audio.play() 105 .then(function(){ 106 107 isPlaying = true; 108 109 playBtn.style.display = 'none'; 110 pauseBtn.style.display = 'flex'; 111 112 console.log('Playing:', currentStream); 113 114 }) 115 .catch(function(error){ 116 117 console.error('Audio play failed:', error); 118 119 }); 120 121 }); 122 123 pauseBtn.addEventListener('click', function(){ 124 125 isPlaying = false; 126 127 audio.pause(); 128 129 audio.removeAttribute('src'); 130 audio.load(); 131 132 pauseBtn.style.display = 'none'; 133 playBtn.style.display = 'flex'; 134 135 }); 136 137 audio.addEventListener('error', function(){ 138 139 console.error('Audio error'); 140 console.error('Source:', audio.src); 141 console.error(audio.error); 142 143 }); 144 145});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.