PageSourceSearch

https://www.radioplus.pl/media/desktop/zpr_radios_web/js/radio_history.min.js?__37b82836

js radioplus.pl collected 2026-09-24 22:36:51 UTC 6,318 bytes, 47 lines download raw bytes

1var startedPlaying,stoppedPlayingEvent,dayChoices
2function playRadioSong(t){var e=t.closest("div.vjsPlayingHistory__hit__buttons")
3setElementSrcFromDataSrc(t),pauseOtherSongs(t),e.classList.contains("active")?(t.pause(),e.classList.remove("active"),document.dispatchEvent(stoppedPlayingEvent)):(t.play(),e.classList.add("active"),t.addEventListener("ended",t=>{e.classList.remove("active"),document.dispatchEvent(stoppedPlayingEvent)}),document.dispatchEvent(startedPlaying))}function setElementSrcFromDataSrc(t){var e=t.getAttribute("data-src")
4t.setAttribute("src",e)}function pauseOtherSongs(t){document.querySelectorAll(".vjsPlayingHistory__audio:not(#"+t.id+")").forEach(function(t){t.pause(),t.closest("div.vjsPlayingHistory__hit__buttons").classList.remove("active")})}function getPlayingHistoryData(t,e="True",a=!1,i=!1){togglePlayingHistoryLoader()
5e=getFetchParams(e,a,i)
6setPlayingHistoryUrl(e),e.teaser||(fillTimepicker(e),manageDayButtonDeactivation()),fetchPlayingHistoryData(t,e)}function getFetchParams(t,e=!1,a=!1){return"True"===t&&"None"!==t&&"False"!==t?{teaser:!0}:(t=parseUrlHash(),{date:e=e||t.date||!1,hour:a=a||t.hour||!1,teaser:!1})}function parseUrlHash(){if(!window.location.hash)return{}
7var a=(window.location.hash||"").replace(/^#/,"").split("&"),i={}
8for(let t=0,e;t<a.length;t++)i[(e=a[t].split("="))[0]]=e[1]
9return i}function setPlayingHistoryUrl(t){t.teaser||t.date&&t.hour&&(window.location.hash=`#date=${t.date}&hour=`+t.hour)}function togglePlayingHistoryLoader(t=!1){var e=document.querySelector(".vjsPlayingHistory__content")
10t?e.classList.remove("spinner"):e.classList.add("spinner")}function getFetchUrl(t,e){return!e.teaser&&e.date&&e.hour?t+`?date=${e.date}&hour=`+e.hour:t+"?min=60"}function fetchPlayingHistoryData(t,e){togglePlayingHistoryLoader()
11t=getFetchUrl(t,e)
12fetch(t).then(t=>t.json()).then(t=>parsePlayingHistoryData(t)).catch(t=>{togglePlayingHistoryLoader(!0),console.log(t)})}function parsePlayingHistoryData(t){let e=[]
13t.forEach(t=>e.push(parseSingleHit(t))),renderRadioHistory(e.reverse())}function parseSingleHit(t){return((t=setSingleHitDefaults(t)).play_date||t.playDate)&&(playDate=moment(t.play_date||t.playDate).utc().format("HH:mm")),{name:t.name,image:t.image,thumb:t.thumb,artists:getArtists(t.artists),playDate:playDate||"",hook:t.hook||t.mp3}}function setSingleHitDefaults(e){return(keys=["name","artists","playDate","image","thumb","hook"]).forEach(function(t){e.hasOwnProperty(t)||(e[t]="")}),e}function getArtists(t){if(!t)return[]
14let e=[]
15return t.forEach(t=>e.push(t.name)),e}function renderRadioHistory(t){var e,a,i=[]
16for([e,a]of t.entries())i.push(renderSingleSong(a,e))
17document.querySelector(".vjsPlayingHistory__content").innerHTML=i.join(""),togglePlayingHistoryLoader(!0)}function renderRadioHistoryError(t){document.querySelector(".vjsPlayingHistory__content").innerHTML="Błąd pobierania danych z API"}
17function renderSingleSong(t,e){var a=renderArtists(t.artists),i=t.name,n=t.thumb||plug_url,o=t.hook,e="song"+e
18return`<div class="vjsPlayingHistory__hit">
19      <div class="vjsPlayingHistory__hit__image">
20        <figure>
21          <img class="lazy-image" loading="lazy" alt="${i}" src="${n}" width="86" height="86">
22        </figure>
23      </div>
24      <div class="vjsPlayingHistory__hit__info">
25        <div class="vjsPlayingHistory__hit__title">${i}</div>
26        <div class="vjsPlayingHistory__hit__author">${a}</div>
27        <div class="vjsPlayingHistory__hit__playdate">Graliśmy o ${t.playDate}</div>
28      </div>
29      <div class="vjsPlayingHistory__hit__buttons">
30        ${o?`<a class="vjsPlayingHistory__hit__play cta-gtm"
31          data-event-category="Hook"
32          data-event-action="${i}"
33          data-event-label="${t.artists.join(", ")}">
34          <audio id="${e}" class="vjsPlayingHistory__audio" data-src="${o}" type="audio/mpeg"></audio>
35          <span class="vjsPlayingHistory__button_play" onclick="playRadioSong(${e})"></span></a>`:""}
36      </div>
37    </div>`}function renderArtists(t){let e=""
38return t.forEach(function(t){e+=`<li>${t}</li>`}),`<ul>${e}</ul>`}function changeDayPicker(t){let e=getDayIndex()
39"left"===t&&0<e&&updateDayPicker(--e),"right"===t&&e<dayChoices.length-1&&updateDayPicker(e+=1)}function updateDayPicker(t){document.getElementById("history-day").innerText=dayChoices[t],manageDayButtonDeactivation(),updateRadioHistory()}function getDayIndex(){var a=document.getElementById("history-day")
40return currentIndex=1,dayChoices.some(function(t,e){a.innerText.toLowerCase()===t.toLowerCase()&&(currentIndex=e)}),currentIndex}function updateRadioHistory(){var t,e=getDayIndex(),a=document.getElementById("history-time-picker").value
41a?(t=moment(),t=(t=e<1?t.subtract(1,"days"):t).format("YYYY-MM-DD"),getPlayingHistoryData(endpoint_url,teaser,t,a)):(window.location.hash="",e<1?(t=moment().subtract(1,"days").format("YYYY-MM-DD"),a=moment().subtract(1,"hour").hour(),getPlayingHistoryData(endpoint_url,teaser,t,a)):getPlayingHistoryData(endpoint_url,teaser,!1,!1))}function fillTimepicker(t){let e='<option value=""></option>'
42setDatepicker(t.date)
43var a=getDayIndex()==dayChoices.length-1?moment().hour():23
44for(i=0;i<=a;i++)e+=generateSelectOptions(i,t.hour)
45document.getElementById("history-time-picker").innerHTML=e}function setDatepicker(t){(yesterday=moment().subtract(1,"days")).format("YYYY-MM-DD")===moment(t).format("YYYY-MM-DD")&&(document.getElementById("history-day").innerText=dayChoices[0])}function getHour(){updateRadioHistory()}function generateSelectOptions(t,e){var a=moment().set({hour:t,minute:0})
46return t==parseInt(e)?`<option selected="selected" value="${i}">${a.format("HH:mm")} - ${a.add(1,"hours").format("HH:mm")}</option>`:`<option value="${i}">${a.format("HH:mm")} - ${a.add(1,"hours").format("HH:mm")}</option>`}function manageDayButtonDeactivation(){var t=document.getElementById("history-day"),e="disable",a=document.getElementById("before-button"),i=document.getElementById("after-button")
47t.innerText.toLowerCase()===dayChoices[0].toLowerCase()&&(a.classList.add(e),i.classList.remove(e)),t.innerText.toLowerCase()===dayChoices[dayChoices.length-1].toLowerCase()&&(i.classList.add(e),a.classList.remove(e))}startedPlaying=new Event("mediaStartedPlaying"),stoppedPlayingEvent=new Event("mediaStoppedPlaying"),dayChoices=["Wczoraj","Dzisiaj"]

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.