Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
164 lines (129 sloc) 5.64 KB
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Val 202 SOS</title>
<style>
body {
font-family:monospace;
font-weight:bold;
#color: red;
background-color: WhiteSmoke;
}
.button {
#width: 100%;
#height: 20px;
position: relative;
background-color: #4CAF50;
border: none;
font-size: 28px;
color: #FFFFFF;
padding: 2px;
#width: 200px;
text-align: center;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
text-decoration: none;
overflow: hidden;
cursor: pointer;
}
.button:after {
content: "";
background: #f1f1f1;
display: block;
position: absolute;
padding-top: 300%;
padding-left: 350%;
margin-left: -20px !important;
margin-top: -120%;
opacity: 0;
transition: all 0.8s
}
.button:active:after {
padding: 0;
margin: 0;
opacity: 1;
transition: 0s
}
.button5 {background-color: #555555;} /* Black */
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript" src="cordova.js"></script>
<script>
function getJSON(url) {
var resp ;
var xmlHttp ;
resp = '' ;
xmlHttp = new XMLHttpRequest();
if (xmlHttp != null) {
xmlHttp.open( "GET", url, false );
xmlHttp.send( null );
resp = xmlHttp.responseText;
}
return resp ;
};
function refreshPlayed() {
var d = new Date();
var n = d.toISOString();
var gjson;
gjson = JSON.parse(getJSON('http://val202.rtvslo.si/api/nowplaying?current_time=' + n));
document.getElementById('ra').innerText = d.toLocaleTimeString();
document.getElementById('an0').innerText = gjson.data[0].attributes['artist-name'];
document.getElementById('st0').innerText = gjson.data[0].attributes['title-name'];
var nd0 = new Date(gjson.data[0].attributes['start-time']);
document.getElementById('pa0').innerText = nd0.toLocaleTimeString();
document.getElementById('an1').innerText = gjson.data[1].attributes['artist-name'];
document.getElementById('st1').innerText = gjson.data[1].attributes['title-name'];
var nd1 = new Date(gjson.data[1].attributes['start-time']);
document.getElementById('pa1').innerText = nd1.toLocaleTimeString();
document.getElementById('an2').innerText = gjson.data[2].attributes['artist-name'];
document.getElementById('st2').innerText = gjson.data[2].attributes['title-name'];
var nd2 = new Date(gjson.data[2].attributes['start-time']);
document.getElementById('pa2').innerText = nd2.toLocaleTimeString();
document.getElementById('an3').innerText = gjson.data[3].attributes['artist-name'];
document.getElementById('st3').innerText = gjson.data[3].attributes['title-name'];
var nd3 = new Date(gjson.data[3].attributes['start-time']);
document.getElementById('pa3').innerText = nd3.toLocaleTimeString();
document.getElementById('an4').innerText = gjson.data[4].attributes['artist-name'];
document.getElementById('st4').innerText = gjson.data[4].attributes['title-name'];
var nd4 = new Date(gjson.data[4].attributes['start-time']);
document.getElementById('pa4').innerText = nd4.toLocaleTimeString();
}
document.write('<H1>Val 202 - SOS</H1>');
//document.write("Refreshed At: <span id='ra'>Refreshed At</span><BR><BR><BR>")
document.write("Artist Name:&nbsp <span id='an0'>Artist Name 0</span><BR>");
document.write("Song Title:&nbsp&nbsp <span id='st0'>Song Title 0</span><BR>");
document.write("Played At:&nbsp&nbsp&nbsp <span id='pa0'>Played At 0</span><BR>");
document.write('<BR><BR>');
/*document.write("<span id='pa0'>Played At 0</span><BR>");
document.write("&nbsp&nbsp&nbsp&nbsp&nbsp <span id='an0'>Artist Name 0</span><BR>");
document.write("&nbsp&nbsp&nbsp&nbsp&nbsp <span id='st0'>Song Title 0</span><BR>");
document.write('<BR><BR>');*/
document.write("Artist Name:&nbsp <span id='an1'>Artist Name 1</span><BR>");
document.write("Song Title:&nbsp&nbsp <span id='st1'>Song Title 1</span><BR>");
document.write("Played At:&nbsp&nbsp&nbsp <span id='pa1'>Played At 1</span><BR>");
document.write('<BR><BR>');
document.write("Artist Name:&nbsp <span id='an2'>Artist Name 2</span><BR>");
document.write("Song Title:&nbsp&nbsp <span id='st2'>Song Title 2</span><BR>");
document.write("Played At:&nbsp&nbsp&nbsp <span id='pa2'>Played At 2</span><BR>");
document.write('<BR><BR>');
document.write("Artist Name:&nbsp <span id='an3'>Artist Name 3</span><BR>");
document.write("Song Title:&nbsp&nbsp <span id='st3'>Song Title 3</span><BR>");
document.write("Played At:&nbsp&nbsp&nbsp <span id='pa3'>Played At 3</span><BR>");
document.write('<BR><BR>');
document.write("Artist Name:&nbsp <span id='an4'>Artist Name 4</span><BR>");
document.write("Song Title:&nbsp&nbsp <span id='st4'>Song Title 4</span><BR>");
document.write("Played At:&nbsp&nbsp&nbsp <span id='pa4'>Played At 4</span><BR>");
document.write('<BR>');
document.write("<BR><button id='btn0' class='button button5' onClick='refreshPlayed()'>refresh</button>ed at: <span id='ra'></span><BR>");
document.write("<audio controls>");
document.write("<source src='http://mp3.rtvslo.si/val202' type='audio/mpeg'>");
document.write("Your browser does not support the audio element.");
document.write("</audio>");
refreshPlayed();
</script>
</body>
</html>
You can’t perform that action at this time.