Add links to playlist entries and the index page

This commit is contained in:
calzoneman 2013-05-12 11:41:14 -04:00
parent 161c8517b2
commit 3af35cb268
7 changed files with 119 additions and 34 deletions

View file

@ -94,6 +94,36 @@
host = "http://" + host;
setInterval(refresh, 10000);
refresh();
function idToURL(data) {
var entry = "";
switch(data.type) {
case "yt":
entry = "http://youtube.com/watch?v="+data.id;
break;
case "vi":
entry = "http://vimeo.com/"+data.id;
break;
case "dm":
entry = "http://dailymotion.com/video/"+data.id;
break;
case "sc":
entry = data.id;
break;
case "li":
entry = "http://livestream.com/"+data.id;
break;
case "tw":
entry = "http://twitch.tv/"+data.id;
break;
case "rt":
case "jw":
entry = data.id;
break;
default:
break;
}
return entry;
}
function refresh() {
$.getJSON(IO_URL+"/api/json/listloaded?filter=public&callback=?", function(data) {
$("#channeldata").find("tbody").remove();
@ -115,7 +145,16 @@
.text(d.name)
.appendTo(name);
$("<td/>").text(d.usercount || 0).appendTo(tr);
$("<td/>").text(d.title || "-").appendTo(tr);
var title = $("<td/>").appendTo(tr);
if(d.media.id) {
$("<a/>").appendTo(title)
.text(d.media.title)
.attr("href", idToURL(d.media))
.attr("target", "_blank");
}
else {
title.text("-");
}
}
});
}