commit
This commit is contained in:
+25
-47
@@ -211,37 +211,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<iframe id="downloadsList" src="{{ assets_url }}/podcasts.txt" onload="loadList();" style="display: none;"></iframe>
|
|
||||||
|
|
||||||
<p><a href="{{ assets_url }}/podcasts.txt">Podcasts</a></p>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// %assets_url%/radio.jpg
|
|
||||||
// %base_url%
|
|
||||||
// {{ base_url }}
|
|
||||||
// {{ assets_url }}
|
|
||||||
|
|
||||||
fetch('{{ assets_url }}/podcasts.txt')
|
|
||||||
.then(
|
|
||||||
function(response) {
|
|
||||||
if (response.status !== 200) {
|
|
||||||
console.log('Looks like there was a problem. Status Code: ' +
|
|
||||||
response.status);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Examine the text in the response
|
|
||||||
response.text().then(function(data) {
|
|
||||||
console.log(data);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.catch(function(err) {
|
|
||||||
console.log('Fetch Error :-S', err);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Activate stream button only on Saturdays and Sundays 15:00-18:00
|
// Activate stream button only on Saturdays and Sundays 15:00-18:00
|
||||||
function streamBtnActivate() {
|
function streamBtnActivate() {
|
||||||
@@ -260,13 +230,7 @@ fetch('{{ assets_url }}/podcasts.txt')
|
|||||||
streamBtnActivate();
|
streamBtnActivate();
|
||||||
setInterval(streamBtnActivate, 10000);
|
setInterval(streamBtnActivate, 10000);
|
||||||
|
|
||||||
/*
|
// menu background transparent when scrolled to top
|
||||||
var box = document.getElementById("nav-podcast");
|
|
||||||
var boxAfter = window.getComputedStyle(box, "::after");
|
|
||||||
console.log(boxAfter.backgroundColor); // getting the background color
|
|
||||||
console.log(boxAfter.opacity); // getting the background color
|
|
||||||
*/
|
|
||||||
|
|
||||||
function menuOpacity() {
|
function menuOpacity() {
|
||||||
const navbar = document.getElementById("navbar");
|
const navbar = document.getElementById("navbar");
|
||||||
if (window.scrollY > 300) {
|
if (window.scrollY > 300) {
|
||||||
@@ -277,18 +241,32 @@ fetch('{{ assets_url }}/podcasts.txt')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadList() {
|
// read podcast list
|
||||||
var oFrame = document.getElementById("downloadsList");
|
fetch('{{ assets_url }}/podcasts.txt').then(
|
||||||
var strRawContents = oFrame.contentWindow.document.body.childNodes[0].innerHTML;
|
function(response) {
|
||||||
while (strRawContents.indexOf("\r") >= 0)
|
if (response.status !== 200) {
|
||||||
strRawContents = strRawContents.replace("\r", "");
|
console.log('Problem fetching podcast list. Status code: ' + response.status);
|
||||||
var arrLines = strRawContents.split("\n");
|
return;
|
||||||
alert("File " + oFrame.src + " has " + arrLines.length + " lines");
|
|
||||||
for (var i = 0; i < arrLines.length; i++) {
|
|
||||||
var curLine = arrLines[i];
|
|
||||||
alert("Line #" + (i + 1) + " is: '" + curLine + "'");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
response.text().then(function(data) {
|
||||||
|
//console.log(data);
|
||||||
|
|
||||||
|
const podcastDiv = document.getElementById("podcast");
|
||||||
|
|
||||||
|
var lines = data.split('\n');
|
||||||
|
for(var i = 0;i < lines.length;i++){
|
||||||
|
var podcastInfo = lines[i].split(';');
|
||||||
|
const podcastTitle = document.createTextNode(lines[i]);
|
||||||
|
podcastDiv.appenChild('<p>' + podcastInfo[0] + '</p>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(function(err) {
|
||||||
|
console.log('Fetch error :-S', err);
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user