Modify /api/channels and /api/allchannels not to include videourl

This commit is contained in:
calzoneman 2013-12-13 00:35:15 -06:00
parent dd5c0e5b82
commit 46baa5532f
2 changed files with 21 additions and 46 deletions

View File

@ -34,15 +34,28 @@ module.exports = function (Server) {
}; };
data.pagetitle = channel.opts.pagetitle; data.pagetitle = channel.opts.pagetitle;
data.media = channel.playlist.current ? data.mediatitle = channel.playlist.current ?
channel.playlist.current.media.pack() : channel.playlist.current.media.title :
{}; "-";
data.usercount = channel.users.length; data.usercount = channel.users.length;
data.voteskip_eligible = channel.calcVoteskipMax(); data.voteskip_eligible = channel.calcVoteskipMax();
data.users = []; data.users = [];
for(var i in channel.users) for(var i in channel.users) {
if(channel.users[i].name !== "") if(channel.users[i].name !== "") {
data.users.push(channel.users[i].name); var name = channel.users[i].name;
var rank = channel.users[i].rank;
if (rank >= 255) {
name = "!" + name;
} else if (rank >= 10) {
name = "~" + name;
} else if (rank >= 3) {
name = "&" + name;
} else if (rank === 2) {
name = "@" + name;
}
data.users.push(name);
}
}
data.chat = []; data.chat = [];
for(var i in channel.chatbuffer) for(var i in channel.chatbuffer)

View File

@ -94,36 +94,6 @@
<script type="text/javascript"> <script type="text/javascript">
setInterval(refresh, 10000); setInterval(refresh, 10000);
refresh(); 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() { function refresh() {
$.getJSON(WEB_URL+"/api/allchannels/public?callback=?", $.getJSON(WEB_URL+"/api/allchannels/public?callback=?",
function(data) { function(data) {
@ -147,15 +117,7 @@
.appendTo(name); .appendTo(name);
$("<td/>").text(d.usercount || 0).appendTo(tr); $("<td/>").text(d.usercount || 0).appendTo(tr);
var title = $("<td/>").appendTo(tr); var title = $("<td/>").appendTo(tr);
if(d.media.id) { title.text(d.mediatitle);
$("<a/>").appendTo(title)
.text(d.media.title)
.attr("href", idToURL(d.media))
.attr("target", "_blank");
}
else {
title.text("-");
}
} }
}); });
} }