sync/www/channelwidget.html

53 lines
1.8 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 type="text/javascript">
var p = document.location + "";
if(p.indexOf("?") != -1) {
p = p.substring(p.indexOf("?")+1);
}
$.getJSON("api/json/channeldata?" + p, function(data) {
var host = document.location + "";
host = host.substring(0, host.indexOf("/widget.html"));
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>