Implement YouTube search, minor fixes, remove "Play Next" button

This commit is contained in:
calzoneman 2013-04-04 11:39:43 -05:00
parent f7bc601fed
commit 362fd0ab23
7 changed files with 102 additions and 16 deletions

View file

@ -323,10 +323,17 @@ function searchLibrary() {
}
$("#library_search").click(searchLibrary);
$("#library_query").keydown(function(ev) {
if(ev.key == 13)
if(ev.keyCode == 13)
searchLibrary();
});
$("#youtube_search").click(function() {
socket.emit("searchLibrary", {
query: $("#library_query").val(),
yt: true
});
});
$("#largelayout").click(largeLayout);
$("#hugelayout").click(hugeLayout);
$("#narrowlayout").click(narrowLayout);

View file

@ -156,11 +156,17 @@ function formatChatMessage(data) {
function makeQueueEntry(video) {
var li = $("<li />");
li.attr("class", "well");
var title = $("<span />").attr("class", "qe_title").appendTo(li);
if(video.thumb) {
$("<img/>").attr("src", video.thumb.url)
.css("float", "left")
.css("clear", "both")
.appendTo(li);
}
var title = $("<span />").addClass("qe_title").appendTo(li);
title.text(video.title);
var time = $("<span />").attr("class", "qe_time").appendTo(li);
var time = $("<span />").addClass("qe_time").appendTo(li);
time.text(video.duration);
var clear = $("<div />").attr("class", "qe_clear").appendTo(li);
var clear = $("<div />").addClass("qe_clear").appendTo(li);
return li;
}
@ -258,7 +264,7 @@ function addLibraryButtons(li, id) {
var btnNext = $("<button />").attr("class", "btn qe_btn").appendTo(btnstrip);
//$("<i />").attr("class", "icon-play").appendTo(btnNext);
btnNext.text("Next");
if(!CHANNELOPTS.qopen_allow_qnext)
if(!CHANNELOPTS.qopen_allow_qnext && RANK < Rank.Moderator && !LEADER)
btnNext.attr("disabled", true);
var btnEnd = $("<button />").attr("class", "btn qe_btn").appendTo(btnstrip);

View file

@ -80,7 +80,6 @@
<button class="btn" id="queue_next">Queue Next</button>
<button class="btn" id="queue_end">Queue @ End</button>
</div>
<button class="btn btn-primary" id="play_next">Play Next</button>
</div>
<button class="btn btn-danger" id="voteskip">Voteskip</button>
<ul id="queue" class="videolist">
@ -89,7 +88,10 @@
</div>
<div class="span6" id="librarydiv">
<input type="text" id="library_query" style="margin:auto;">
<button class="btn" id="library_search">Search Library</button>
<div class="btn-group">
<button class="btn" id="library_search">Search Library</button>
<button class="btn" id="youtube_search">Search YouTube</button>
</div>
<ul id="library" class="videolist">
</ul>
</div>
@ -133,7 +135,7 @@
</label>
<label class="checkbox">
<input type="checkbox" id="opt_qopen_allow_playnext">
Allow anyone to skip to next video
Allow anyone to jump to a video
</label>
</div>
<div class="span5">