const el = function (id) { return document.getElementById(id); }; const dynamicContent = { loadLabels: function (labels, mode) { if (typeof labels["voteNumber"] != "undefined" && el("voteNumber")) { el("voteNumber").innerText = labels["voteNumber"]; } if (typeof labels["ctaBtnText"] != "undefined" && el("ctaBtnText")) { el("ctaBtnText").innerText = labels["ctaBtnText"]; } if (typeof labels["patronCounter"] != "undefined" && el("patronCounter")) { if (typeof count != "undefined") { count.update(labels["patronCounter"]); } else { el("patronCounter").innerText = labels["patronCounter"]; } } }, loadArchive: function (archive, mode) { if (mode == "top") return; let tempHtml = ""; archive.forEach((item) => { const htmlTemplate = `
#${item.no}
${item.date}
`; tempHtml += htmlTemplate; }); el("archiveListItems").innerHTML = tempHtml; el("chartArchive").style.display = "block"; }, loadTracks: function (mode) { if (mode == "top") return; const variants = [1, 2, 3, 4, 5]; //, 6, 7, 8, 9, 10]; const set = variants[Math.floor(Math.random() * variants.length)]; const xhr = new XMLHttpRequest(); xhr.open( "GET", "https://bocdn.radio357.pl/lp/lista/dynamicContent.php?tracks=" + set, true ); xhr.onload = function () { let response = JSON.parse(this.response); if ( typeof response != "undefined" && typeof response[0] != "undefined" && typeof response[0]["song"] != "undefined" ) { let tempHtml = ""; let index = 1; response.forEach((item) => { const selectedClass = item.selected == "1" ? "selected" : ""; const htmlTemplate = `

${item.artist}

${item.song}

`; index++; tempHtml += htmlTemplate; }); el("artistCloud").innerHTML = tempHtml; el("artistCloud").style.display = "block"; } }; xhr.onerror = function () {}; xhr.send(); }, }; if (typeof dynamicContent.loadLabels != 'undefined') dynamicContent.loadLabels({"voteNumber":"Notowanie #132","ctaBtnText":"Widzisz co\u015b dla siebie","patronCounter":"49529"}, ""); if (typeof dynamicContent.loadArchive != 'undefined') dynamicContent.loadArchive([{"link":"https:\/\/wyniki.radio357.pl\/lista\/131?ret=https%3A%2F%2Flista.radio357.pl","no":"131","date":"26.04.2024"},{"link":"https:\/\/wyniki.radio357.pl\/lista\/130?ret=https%3A%2F%2Flista.radio357.pl","no":"130","date":"19.04.2024"},{"link":"https:\/\/wyniki.radio357.pl\/lista\/129?ret=https%3A%2F%2Flista.radio357.pl","no":"129","date":"12.04.2024"}], ""); if (typeof dynamicContent.loadTracks != 'undefined') dynamicContent.loadTracks("");