commit
This commit is contained in:
+25
-47
@@ -211,37 +211,7 @@
|
||||
</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>
|
||||
// %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
|
||||
function streamBtnActivate() {
|
||||
@@ -260,13 +230,7 @@ fetch('{{ assets_url }}/podcasts.txt')
|
||||
streamBtnActivate();
|
||||
setInterval(streamBtnActivate, 10000);
|
||||
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
// menu background transparent when scrolled to top
|
||||
function menuOpacity() {
|
||||
const navbar = document.getElementById("navbar");
|
||||
if (window.scrollY > 300) {
|
||||
@@ -277,18 +241,32 @@ fetch('{{ assets_url }}/podcasts.txt')
|
||||
}
|
||||
}
|
||||
|
||||
function loadList() {
|
||||
var oFrame = document.getElementById("downloadsList");
|
||||
var strRawContents = oFrame.contentWindow.document.body.childNodes[0].innerHTML;
|
||||
while (strRawContents.indexOf("\r") >= 0)
|
||||
strRawContents = strRawContents.replace("\r", "");
|
||||
var arrLines = strRawContents.split("\n");
|
||||
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 + "'");
|
||||
// read podcast list
|
||||
fetch('{{ assets_url }}/podcasts.txt').then(
|
||||
function(response) {
|
||||
if (response.status !== 200) {
|
||||
console.log('Problem fetching podcast list. Status code: ' + response.status);
|
||||
return;
|
||||
}
|
||||
|
||||
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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user