Updated embedded player to work with the new offline functions

This commit is contained in:
Kasper Rynning-Tønnesen
2017-01-25 19:17:24 +01:00
parent 02b946448f
commit 01d4a38353
7 changed files with 55 additions and 18 deletions

View File

@@ -983,6 +983,7 @@ hide mdi-action-visibility mdi-action-visibility-off
#wrapper {
padding-right:0vh !important;
width:100% !important;
overflow:hidden;
}
}
@@ -1914,6 +1915,7 @@ nav ul li:hover, nav ul li.active {
overflow: auto;
/*padding-right: 5vh;*/
opacity: 1;
overflow:hidden;
}
#playlist{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -154,7 +154,7 @@ var Admin = {
}
if($(".card-action").length !== 0 &&
!Helper.contains($(".card-action").attr("class").split(" "), "hide")){
!Helper.contains($(".card-action").attr("class").split(" "), "hide") && !offline){
$(".card-action").addClass("hide");
}

View File

@@ -11,6 +11,7 @@ var adminpass = "";
var mobile_beginning = false;
var durationBegun = false;
var chromecastAvailable = false;
var offline = false;
var seekTo;
var socket;

View File

@@ -301,11 +301,33 @@ var List = {
try{
to_delete.style.height = 0;
if(index < List.page && $("#wrapper").children().length - (List.page + 2) >= 0){
$($("#wrapper").children()[List.page]).css("height", 0);
$($("#wrapper").children()[List.page]).css("display", "block");
$($("#wrapper").children()[List.page]).css("height", List.element_height);
} else if($("#wrapper").children().length > List.page + (List.can_fit)){
$($("#wrapper").children()[List.page + (List.can_fit)]).css("height", 0);
$($("#wrapper").children()[List.page + (List.can_fit)]).css("display", "block");
$($("#wrapper").children()[List.page + (List.can_fit)]).css("height", List.element_height);
}
if(List.page >= $("#wrapper").children().length - 1){
List.dynamicContentPage(-1);
$(".next_page_hide").css("display", "inline-block");
$(".next_page").css("display", "none");
$(".last_page_hide").css("display", "inline-block");
$(".last_page").css("display", "none");
} else if(List.page + List.can_fit + 1 >= $("#wrapper").children().length - 1){
$(".next_page_hide").css("display", "inline-block");
$(".next_page").css("display", "none");
$(".last_page_hide").css("display", "inline-block");
$(".last_page").css("display", "none");
}
setTimeout(function()
{
$("#"+deleted).remove();
full_playlist.splice(List.getIndexOfSong(deleted), 1);
if(index < List.page && $("#wrapper").children().length - (List.page + 1) >= 0){
/*if(index < List.page && $("#wrapper").children().length - (List.page + 1) >= 0){
$($("#wrapper").children()[List.page - 1]).css("display", "block");
} else if($("#wrapper").children().length > List.page + (List.can_fit-1)){
$($("#wrapper").children()[List.page + (List.can_fit - 1)]).css("display", "block");
@@ -315,7 +337,7 @@ var List = {
} else if(List.page + List.can_fit >= $("#wrapper").children().length){
$(".next_page_hide").css("display", "inline-block");
$(".next_page").css("display", "none");
}
}*/
if(chromecastAvailable){
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
}
@@ -341,9 +363,9 @@ var List = {
$("#wrapper").append("<span id='empty-channel-message'>The playlist is empty.</span>");
}
$("#suggested-"+deleted).remove();
if(List.page + List.can_fit < $("#wrapper").children().length){
$(".next_page_hide").css("display", "none");
$(".next_page").css("display", "inline-block");
if(List.page + List.can_fit < $("#wrapper").children().length + 1){
//$(".next_page_hide").css("display", "none");
//$(".next_page").css("display", "inline-block");
}
if(List.page >= $("#wrapper").children().length){
List.dynamicContentPage(-1);
@@ -392,12 +414,16 @@ var List = {
},
vote: function(id, vote){
if(!offline){
socket.emit('vote', {channel: chan, id: id, type: vote, adminpass: adminpass});
} else {
List.voted_song(id, (new Date()).getTime()/1000);
}
return true;
if(!offline || (vote == "del" && (hasadmin && (!w_p && adminpass != "")))){
socket.emit('vote', {channel: chan, id: id, type: vote, adminpass: adminpass});
} else {
if(vote == "pos"){
List.voted_song(id, (new Date()).getTime()/1000);
} else {
List.deleted_song(id);
}
}
return true;
},
skip: function(){

View File

@@ -504,11 +504,13 @@ function change_offline(enabled){
list_html.find(".card-content").css("height", "100%");
list_html.find(".list-title").css("align-self", "center");
list_html.find(".vote-span").addClass("hide");
list_html.find(".list-remove").removeClass("hide");
list_html = list_html.html();
}
$(".card-content").css("display", "flex");
$(".card-content").css("height", "100%");
$(".list-title").css("align-self", "center");
$(".list-remove").removeClass("hide");
$(".vote-span").addClass("hide");
$("#viewers").addClass("hide");
$("#offline-mode").removeClass("waves-cyan");
@@ -520,6 +522,9 @@ function change_offline(enabled){
list_html.find(".card-content").css("height", "initial");
list_html.find(".list-title").css("align-self", "center");
list_html.find(".vote-span").removeClass("hide");
if((!hasadmin || !w_p)){
list_html.find(".list-remove").addClass("hide");
}
list_html = list_html.html();
}
$(".card-content").css("display", "block");
@@ -527,6 +532,9 @@ function change_offline(enabled){
$(".list-title").css("align-self", "center");
$(".vote-span").removeClass("hide");
$("#viewers").removeClass("hide");
if((!hasadmin || !w_p)){
$(".list-remove").addClass("hide");
}
$("#offline-mode").addClass("waves-cyan");
$("#offline-mode").removeClass("cyan");
if(window.location.pathname != "/"){