flowerpower
This commit is contained in:
65
public/home/home/bcast.js
Executable file
65
public/home/home/bcast.js
Executable file
@@ -0,0 +1,65 @@
|
||||
|
||||
window.onload = function(){
|
||||
radioUpdate();
|
||||
|
||||
function radioUpdate(){
|
||||
d3.json(radio_server +"/status-json.xsl")
|
||||
.timeout(10000)
|
||||
.get(function(e,d){
|
||||
if(e !=undefined){
|
||||
console.warn("sin conxion");
|
||||
offline();}
|
||||
else{
|
||||
if(d.icestats.source!=undefined){
|
||||
if(d.icestats.source.listenurl == webm_listen_url){
|
||||
console.log("transmitiendo video");
|
||||
onlinev(d); }
|
||||
else if (d.icestats.source.listenurl == radio_listen_url){
|
||||
console.log("transmitiendo radio");
|
||||
onliner(d); }
|
||||
else {
|
||||
console.warn("otro canal");
|
||||
offline(); }}
|
||||
else {
|
||||
console.warn("fuera de línea");
|
||||
offline();
|
||||
}
|
||||
} }); };
|
||||
|
||||
|
||||
function dataUpdate(){
|
||||
d3.json(radio_server+"/status-json.xsl")
|
||||
.timeout(10000)
|
||||
.get(function(e,d){
|
||||
if(e !=undefined){ console.warn("sin datos radio"); }
|
||||
else{
|
||||
if(d.icestats.source!=undefined){
|
||||
if(d.icestats.source.listenurl == listen_url ){
|
||||
d3.select("#now").text(d.icestats.source.title);
|
||||
}}}
|
||||
|
||||
d3.select("#ra").transition().on("end",dataUpdate).delay(60000);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function offline(){
|
||||
d3.selectAll("article.broadcast").style("display","none")
|
||||
d3.select("article.broadcast").transition().on("end",radioUpdate).delay(90000);
|
||||
};
|
||||
|
||||
function onlinev(d){
|
||||
d3.selectAll("article.broadcast")
|
||||
.style("display","block")
|
||||
.on("click",function(){window.location="bcast";});
|
||||
dataUpdate();
|
||||
}
|
||||
function onliner(d){
|
||||
d3.selectAll(".broadcast")
|
||||
.style("display","block")
|
||||
.on("click",function(){window.location="radio";});
|
||||
dataUpdate();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -33,3 +33,25 @@ p.mod{
|
||||
padding:5% 5%;
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
article.broadcast{
|
||||
position: absolute;
|
||||
display: none;
|
||||
margin: 33vh auto;
|
||||
width: 100%;
|
||||
color: white;
|
||||
align-content: center;
|
||||
text-align: center;
|
||||
-webkit-align-content: center;
|
||||
text-align: center;
|
||||
padding: 2px;
|
||||
background-color: rgba(0,0,0,0.8);
|
||||
cursor:pointer;
|
||||
}
|
||||
article.broadcast:hover{
|
||||
background-color: rgba(0,0,0,1);
|
||||
}
|
||||
p.broadcast{
|
||||
font-size: 1.9em;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user