Continue working on API
This commit is contained in:
parent
3c2b5fcb2c
commit
a88088f2d6
5 changed files with 177 additions and 20 deletions
52
www/channelwidget.html
Normal file
52
www/channelwidget.html
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<!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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue