sync/www/channelwidget.html

56 lines
2.0 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CyTube</title>
<link href="assets/css/bootstrap.css" rel="stylesheet">
<style type="text/css">
#channeldata td, #channeldata th {
text-align: center;
vertical-align: middle;
}
</style>
</head>
<body>
<table id="channeldata" class="table table-striped table-bordered">
<thead>
<tr>
<th>Channel</th>
<th>Connected</th>
<th>Playing</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script src="assets/js/jquery.js" type="text/javascript"></script>
<script src="assets/js/iourl.js" type="text/javascript"></script>
<script type="text/javascript">
var p = document.location + "";
var host = p.replace("http://", "");
if(host.indexOf("/") != -1) {
host = host.substring(0, host.indexOf("/"));
}
if(p.indexOf("?") != -1) {
p = p.substring(p.indexOf("?")+1);
}
$.getJSON(IO_URL+"/api/json/channeldata?"+p+"&callback=?", function(data) {
if(data.error) {
return;
}
$("#channeldata").find("tbody").remove();
for(var i = 0; i < data.length; i++) {
var d = data[i];
var tr = $("<tr/>").appendTo($("#channeldata"));
var name = $("<td/>").appendTo(tr);
$("<a/>").attr("href", host + "/r/" + d.name)
.text(d.name)
.appendTo(name);
$("<td/>").text(d.usercount || 0).appendTo(tr);
$("<td/>").text(d.title || "-").appendTo(tr);
}
});
</script>
</body>
</html>