mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Votes and shuffled lists remain the same if the user navigates from a frontpage, and back to the same list in private mode
This commit is contained in:
4
public/dist/embed.min.js
vendored
4
public/dist/embed.min.js
vendored
File diff suppressed because one or more lines are too long
8
public/dist/main.min.js
vendored
8
public/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -282,6 +282,8 @@ var Frontpage = {
|
||||
|
||||
if(!popstate){
|
||||
window.history.pushState("to the channel!", "Title", "/" + new_channel);
|
||||
if(prev_chan_list == "") prev_chan_list = new_channel;
|
||||
if(prev_chan_player == "") prev_chan_player = new_channel;
|
||||
window.chan = new_channel;
|
||||
}
|
||||
|
||||
@@ -376,7 +378,7 @@ function initfp(){
|
||||
|
||||
Crypt.init();
|
||||
if(Crypt.get_offline()){
|
||||
change_offline(true);
|
||||
change_offline(true, offline);
|
||||
}
|
||||
|
||||
socket.emit('frontpage_lists');
|
||||
|
||||
@@ -14,11 +14,17 @@ var List = {
|
||||
{
|
||||
case "list":
|
||||
//if(full_playlist == undefined || !offline){
|
||||
if(!offline || (offline && !msg.shuffled)){
|
||||
if((!offline || (offline && !msg.shuffled)) && !(offline && prev_chan_list == chan)){
|
||||
prev_chan_list = chan;
|
||||
List.populate_list(msg.playlist);
|
||||
if(chromecastAvailable){
|
||||
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
|
||||
}
|
||||
} else if(offline && prev_chan_list == chan && full_playlist != undefined && !msg.shuffled){
|
||||
List.populate_list(full_playlist, true);
|
||||
if(chromecastAvailable){
|
||||
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "added":
|
||||
@@ -84,7 +90,7 @@ var List = {
|
||||
}
|
||||
},
|
||||
|
||||
populate_list: function(msg)
|
||||
populate_list: function(msg, no_reset)
|
||||
{
|
||||
if(!Helper.mobilecheck() && !embed){
|
||||
List.can_fit = Math.round(($("#wrapper").height()) / 71)+1;
|
||||
@@ -98,7 +104,7 @@ var List = {
|
||||
}
|
||||
if(list_html === undefined) list_html = $("#list-song-html").html();
|
||||
full_playlist = msg;
|
||||
if(offline){
|
||||
if(offline && !no_reset){
|
||||
for(var x = 0; x < full_playlist.length; x++){
|
||||
full_playlist[x].votes = 0;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ var color = "808080";
|
||||
var find_start = false;
|
||||
var find_started = false;
|
||||
var offline = false;
|
||||
var prev_chan_list = "";
|
||||
var prev_chan_player = "";
|
||||
var chromecastReady = false;
|
||||
var found_array = [];
|
||||
var found_array_index = 0;
|
||||
@@ -198,7 +200,7 @@ function init(){
|
||||
Crypt.init();
|
||||
if(Crypt.get_offline()){
|
||||
$(".offline_switch_class")[0].checked = true;
|
||||
change_offline(true);
|
||||
change_offline(true, offline);
|
||||
}
|
||||
|
||||
if($("#alreadychannel").length === 0 || Helper.mobilecheck()){
|
||||
@@ -497,7 +499,7 @@ function randomString(length){
|
||||
return text;
|
||||
}
|
||||
|
||||
function change_offline(enabled){
|
||||
function change_offline(enabled, already_offline){
|
||||
Crypt.set_offline(enabled);
|
||||
offline = enabled;
|
||||
socket.emit("offline", enabled);
|
||||
@@ -519,7 +521,7 @@ function change_offline(enabled){
|
||||
$("#viewers").addClass("hide");
|
||||
$("#offline-mode").removeClass("waves-cyan");
|
||||
$("#offline-mode").addClass("cyan");
|
||||
if(full_playlist != undefined){
|
||||
if(full_playlist != undefined && !already_offline){
|
||||
for(var x = 0; x < full_playlist.length; x++){
|
||||
full_playlist[x].votes = 0;
|
||||
}
|
||||
@@ -599,9 +601,9 @@ $(document).keyup(function(e) {
|
||||
$(document).on("click", "#offline-mode", function(e){
|
||||
e.preventDefault();
|
||||
if(!Crypt.get_offline()){
|
||||
change_offline(true);
|
||||
change_offline(true, offline);
|
||||
} else{
|
||||
change_offline(false);
|
||||
change_offline(false, offline);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -766,7 +768,7 @@ $(document).on("change", 'input[class=offline_switch_class]', function()
|
||||
{
|
||||
//Hostcontroller.change_enabled(document.getElementsByName("remote_switch")[0].checked);
|
||||
offline = document.getElementsByName("offline_switch")[0].checked;
|
||||
change_offline(offline);
|
||||
change_offline(offline, !offline);
|
||||
});
|
||||
|
||||
$(document).on("change", 'input[class=conf]', function()
|
||||
|
||||
@@ -14,7 +14,8 @@ var Player = {
|
||||
}catch(e){
|
||||
state = null;
|
||||
}
|
||||
if((!offline && (state != null || from_frontpage)) || (offline && (!(state != null) || from_frontpage))|| (!offline && (!(state != null) || from_frontpage)) || (offline && state == -1)){
|
||||
if(((!offline && (state != null || from_frontpage)) || (offline && (!(state != null) || from_frontpage))|| (!offline && (!(state != null) || from_frontpage)) || (offline && state == -1)) && !(offline && prev_chan_player == chan)){
|
||||
prev_chan_player = chan;
|
||||
from_frontpage = false;
|
||||
Player.loaded = false;
|
||||
Helper.log("--------youtube_listener--------");
|
||||
@@ -114,6 +115,7 @@ var Player = {
|
||||
} else {
|
||||
if(!durationBegun)
|
||||
Player.durationSetter();
|
||||
duration = Player.player.getDuration();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user