1/** 2 * Amura Media 3 * Hernan Roig -> [email protected] 4**/ 5 6const front = document.getElementById("front"); 7const url_root = front.dataset.root; 8const body = document.querySelector("body"); 9const header = document.querySelector(".header"); 10 11//Hamburger 12const hamburger = document.querySelector(".hamburger"); 13const menu_overlay = document.querySelector(".menu-overlay"); 14const close_menu = document.getElementById("close-menu"); 15 16hamburger.addEventListener('click',e =>{ 17 e.preventDefault(); 18 hamburger.classList.toggle('open'); 19 menu_overlay.classList.toggle("open"); 20 body.classList.add("open"); 21}) 22 23const search = document.getElementById("active-search"); 24search.addEventListener('click', async e =>{ 25 e.preventDefault(); 26 let nodo = search.closest(".search-header"); 27 let search_input = nodo.querySelector(".search-input"); 28 search_input.classList.toggle('open'); 29 search.classList.toggle('open'); 30 search_input.focus(); 31}); 32const searchForm = document.getElementById("search"); 33searchForm.addEventListener("submit",e =>{ 34 const data = new FormData(event.target); 35 const dataObject = Object.fromEntries(data.entries()); 36 if(dataObject.q.length!==0){ 37 return true; 38 } 39 e.preventDefault(); 40}) 41 42/*Radio*/ 43const stream_audio = document.getElementById("stream_audio"); 44const audio_src = "https://unlimited2-ar.dps.live/lacoope/aac/icecast.audio"; 45let stream_sound = false; 46const radio = document.getElementById("bt_audio"); 47 48if (radio) { 49 radio.addEventListener('click', async e => { 50 e.preventDefault(); 51 const layout_volumen = document.querySelector('.layout-audio'); 52 radio.classList.toggle('pause'); 53 54 if (stream_sound !== false) { 55 stream_audio.pause(); 56 stream_audio.src = ""; 57 stream_sound = false; 58 layout_volumen.classList.remove('show'); 59 } else { 60 stream_audio.src = audio_src; 61 stream_audio.play().catch(error => { 62 console.error("Error al reproducir:", error); 63 }); 64 stream_sound = true; 65 layout_volumen.classList.add('show'); 66 } 67 }); 68} 69 70/*Radio*/ 71/* 72const stream_audio = document.getElementById("stream_audio"); 73const audio_src = "https://redirector.dps.live/hls-audio/4e252a65837b69e349d5d8c1033152b4/lacoope/playlist/manifest/gotardisz/audio/now/livestream1.m3u8"; 74let stream_sound = false; 75const radio = document.getElementById("bt_audio"); 76if(radio){ 77 radio.addEventListener('click', async e =>{ 78 e.preventDefault(); 79 const layout_volumen = document.querySelector('.layout-audio'); 80 radio.classList.toggle('pause'); 81 if(stream_sound!==false){ 82 stream_audio.pause(); 83 stream_sound = false; 84 layout_volumen.classList.remove('show'); 85 }else{ 86 if (stream_audio.canPlayType('application/vnd.apple.mpegurl')) { 87 stream_audio.src = audio_src; 88 } else if (Hls.isSupported()) { 89 var hls = new Hls(); 90 hls.loadSource(audio_src); 91 hls.attachMedia(stream_audio); 92 } 93 stream_audio.play(); 94 stream_sound = true; 95 layout_volumen.classList.add('show'); 96 } 97 }) 98} 99*/ 100const volumeControl = document.getElementById("volume-control"); 101if (volumeControl) { 102 volumeControl.addEventListener('input', (e) => { 103 const volume = e.target.value / 100; // Convertir valor de 0 a 1 104 stream_audio.volume = volume; 105 106 if (volume === 0) { 107 volumeIcon.classList.remove('fa-volume-up'); 108 volumeIcon.classList.add('fa-volume-mute'); 109 } else { 110 volumeIcon.classList.remove('fa-volume-mute'); 111 volumeIcon.classList.add('fa-volume-up'); 112 } 113 }); 114 115 stream_audio.volume = volumeControl.value / 100; 116} 117const volumeIcon = document.getElementById("volume-icon"); 118let lastVolume = 1; // ultimo volumen 119if (volumeIcon) { 120 volumeIcon.addEventListener('click', () => { 121 if (stream_audio.muted) { 122 stream_audio.muted = false; 123 volumeControl.value = lastVolume * 100; 124 stream_audio.volume = lastVolume; 125 volumeIcon.classList.remove('fa-volume-mute'); 126 volumeIcon.classList.add('fa-volume-up'); 127 } else { 128 lastVolume = stream_audio.volume; 129 stream_audio.muted = true; 130 volumeControl.value = 0; 131 volumeIcon.classList.remove('fa-volume-up'); 132 volumeIcon.classList.add('fa-volume-mute'); 133 } 134 });
135} 136 137const links = document.querySelectorAll("a"); 138links.forEach((link) => { 139 link.addEventListener('click', async e =>{ 140 if(window.location.host==e.currentTarget.host){ 141 if(stream_sound!==false){ 142 if (e.currentTarget.nodeName == "A" && !e.currentTarget.hasAttribute("target")) { 143 e.currentTarget.setAttribute("target", "_blank"); 144 } 145 }else{ 146 e.currentTarget.setAttribute("target", "_self"); 147 } 148 } 149 }) 150}); 151 152/*Streaming*/ 153const flyer = document.getElementById("flyer"); 154const flyer_c = document.querySelector('#flyer_c') 155const video = document.getElementById("bt_video"); 156if(video){ 157 video.addEventListener('click', async e =>{ 158 e.preventDefault(); 159 let obj = /(youtu.*be.*)\/(watch\?v=|embed\/|v|shorts|)(.*?((?=[&#?])|$))/gm; 160 if (video.href.match(/^(https?\:\/\/)?(www\.youtube\.com|youtu\.?be)\/.+/)) { 161 let cod = obj.exec(video.href)[3]; 162 //oculto 163 flyer.style.display = "none"; 164 flyer_c.querySelector("iframe").src = "https://www.youtube.com/embed/" + cod + "?autoplay=1"; 165 flyer_c.style.display = "block"; 166 } else { 167 //oculto 168 flyer.style.display = "none"; 169 flyer_c.querySelector("iframe").src = video.href; 170 flyer_c.style.display = "block"; 171 } 172 173 }) 174} 175 176const element = 150; 177window.addEventListener('scroll', () => { 178 let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; 179 if (scrollTop >= element){ 180 front.classList.add("stiky"); 181 header.classList.add('fix'); 182 }else if (scrollTop < element){ 183 front.classList.remove("stiky"); 184 header.classList.remove('fix'); 185 } 186 187 /*picture and picture*/ 188 const windowScrollTop = window.pageYOffset || document.documentElement.scrollTop; 189 const videoWrap = document.querySelector('.streaming-wrap'); 190 const video = document.querySelector('.streaming-video'); 191 if(video && videoWrap){ 192 const videoHeight = video.offsetHeight; 193 const videoWrapOffsetTop = videoWrap.offsetTop; 194 const videoBottom = videoHeight + videoWrapOffsetTop; 195 196 if (windowScrollTop > videoBottom) { 197 videoWrap.style.height = videoHeight + 'px'; 198 video.classList.add('stuck'); 199 } else { 200 videoWrap.style.height = 'auto'; 201 video.classList.remove('stuck'); 202 } 203 } 204}); 205 206var trackSocial = function(red,url,text) { 207 if (red == 'facebook' ){ 208 FBShare(url) 209 }else if (red == 'twitter'){ 210 TWShare(url, text); 211 }else if (red == 'whatsapp'){ 212 WAShare(url, text) 213 }else if (red == 'telegram'){ 214 TGShare(url, text) 215 }else if (red == 'reddit'){ 216 RDShare(url, text) 217 }else if (red == 'linkedin'){ 218 LIShare(url) 219 } 220 221} 222 223var FBShare = function (url) 224{ 225 if(!url) 226 return false; 227 var urlShare = 'https://www.facebook.com/sharer.php?u='+encodeURI(url); 228 popupwindow(urlShare,'Comparte en Facebook', 350, 350); 229} 230 231var TWShare = function(url, text) 232{ 233 if(!url) 234 return false; 235 var urlShare = 'https://twitter.com/intent/tweet?original_referer='+encodeURIComponent(url)+'&url='+encodeURIComponent(url)+"&text="+encodeURIComponent(text) + "&source=tweetbutton"; 236 popupwindow(urlShare,'Comparte en Twitter', 450, 250); 237 238} 239var popupwindow = function(url, title, w, h) { 240 var left = (screen.width/2)-(w/2); 241 var top = (screen.height/2)-(h/2); 242 return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); 243} 244var WAShare = function (url, tit) 245{ 246 var correctTitle = tit.replace(/ยด/g,"'"); 247 var textCodif = correctTitle + " " + url; 248 document.location.href="https://api.whatsapp.com/send?text="+encodeURI(textCodif); 249} 250var TGShare = function (url, tit) 251{ 252 document.location.href="tg://msg_url="+encodeURI(url)+"?text=="+encodeURI(tit); 253 254} 255var RDShare = function (url, tit) 256{ 257 document.location.href='https://www.reddit.com/submit?url='+encodeURI(url)+'&title='+encodeURI(tit); 258} 259 260var LIShare = function (url) 261{ 262 document.location.href='https://www.linkedin.com/sharing/share-offsite/?url='+encodeURI(url); 263} 264 265 266
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.