sync/www/channelwidget.html

56 lines
2.0 KiB
HTML
Raw Normal View History

2013-04-25 21:16:53 +00:00
<!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>
2013-04-26 04:57:46 +00:00
<script src="assets/js/iourl.js" type="text/javascript"></script>
2013-04-25 21:16:53 +00:00
<script type="text/javascript">
var p = document.location + "";
2013-04-27 16:54:35 +00:00
var host = p.replace("http://", "");
if(host.indexOf("/") != -1) {
host = host.substring(0, host.indexOf("/"));
}
2013-04-25 21:16:53 +00:00
if(p.indexOf("?") != -1) {
p = p.substring(p.indexOf("?")+1);
}
2013-04-26 04:57:46 +00:00
$.getJSON(IO_URL+"/api/json/channeldata?"+p+"&callback=?", function(data) {
2013-04-25 21:16:53 +00:00
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>