Added YouTube suggested songs

This commit is contained in:
Kasper Rynning-Tønnesen
2015-12-14 13:41:26 +01:00
parent d9e2f7ab6c
commit 6306d569ac
6 changed files with 121 additions and 11 deletions

View File

@@ -75,6 +75,7 @@ var Admin = {
$("#admin-lock").removeClass("mdi-action-lock");
$("#password").val("");
$("#password").attr("placeholder", "Change channel password")
$(".suggestion-panel").removeClass("hide");
if(!Helper.contains($("#admin-lock").attr("class").split(" "), "mdi-action-lock-open"))
$("#admin-lock").addClass("mdi-action-lock-open clickable");
@@ -130,13 +131,17 @@ var Admin = {
$("#admin-lock").addClass("mdi-action-lock");
}
if(!Helper.contains($(".suggestion-panel").attr("class").split(" "), "hide")){
$(".suggestion-panel").addClass("hide");
}
if($(".card-action").length != 0 &&
!Helper.contains($(".card-action").attr("class").split(" "), "hide")){
$(".card-action").addClass("hide");
}
$("#admin-lock").removeClass("mdi-action-lock-open clickable");
$("#password").attr("placeholder", "Enter channel password")
$("#password").attr("placeholder", "Enter channel password");
},
//function used in html onlick
@@ -151,6 +156,7 @@ var Admin = {
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
"removeplay", "skip", "shuffle"];
if(conf_array['adminpass'] == "" || !w_p)
hasadmin = false;
else hasadmin = true;
@@ -198,4 +204,9 @@ var Admin = {
socket.emit('shuffle', adminpass !== undefined ? adminpass : "");
},
get_admin:function()
{
return w_p;
}
}

View File

@@ -3,6 +3,7 @@ var w_p = true;
var hasadmin = 0;
var showToggle = true;
var list_html = $("#list-song-html").html();
var suggest_html = $("#suggest-song-html").html();
var blink_interval_exists = false;
var unseen = false;
var timer = 0;
@@ -38,7 +39,7 @@ var video_id;
var list;
var seekTo;
var song_title;
var previous_video_id;
var connection_options = {
'sync disconnect on unload':true,
'secure': true
@@ -286,17 +287,19 @@ $("#closeSettings").on("click", function()
$("#results").on( "click", "#temp-results", function(e){
if($(e.target).html() != $("<i class='mdi-av-playlist-add'></i>").html()){
var id = $(this).attr("data-video-id");
var title = $(this).attr("data-video-title");
var length = $(this).attr("data-video-length")
var id = $(this).attr("data-video-id");
var title = $(this).attr("data-video-title");
var length = $(this).attr("data-video-length");
Search.submitAndClose(id, title, length);
}
});
$("#results").on( "click", "#add-many", function(e){
var id = $(this).attr("data-video-id");
var title = $(this).attr("data-video-title");
var length = $(this).attr("data-video-length")
var id = $(this).attr("data-video-id");
var title = $(this).attr("data-video-title");
var length = $(this).attr("data-video-length");
Search.submit(id, title, length);
});
@@ -308,4 +311,20 @@ $("#wrapper").on( "click", ".vote-container", function(e){
$("#wrapper").on( "click", "#del", function(e){
var id = $(this).attr("data-video-id");
List.vote(id, "del");
});
$(".suggestion-container").on( "click", ".accept", function(e){
var id = $(this).attr("data-video-id");
var title = $(this).attr("data-video-title");
var length = $(this).attr("data-video-length");
Search.submit(id, title, length);
$(".suggest-" + id).remove();
});
$(".suggestion-container").on( "click", ".decline", function(e){
var id = $(this).attr("data-video-id");
$(".suggest-" + id).remove();
});

View File

@@ -17,6 +17,11 @@ var Youtube = {
}
else{
//console.log("gotten new song");
if(previous_video_id == undefined)
previous_video_id = obj[0][0]["id"];
else if(previous_video_id != video_id)
previous_video_id = video_id;
video_id = obj[0][0]["id"];
conf = obj[1][0];
time = obj[2];
@@ -25,6 +30,7 @@ var Youtube = {
$("#player_overlay").addClass("hide");
Suggestions.fetchYoutubeSuggests(video_id);
Youtube.getTitle(song_title, viewers);
Youtube.setBGimage(video_id);
//if(player_ready && !window.mobilecheck())