diff --git a/server/handlers/list.js b/server/handlers/list.js index 5b14f1da..10ff1ca0 100644 --- a/server/handlers/list.js +++ b/server/handlers/list.js @@ -504,9 +504,9 @@ function sendColor(coll, socket, id) { var c = ColorThief.getColor(image); if(socket) { - socket.emit("color", {color: c}); + socket.emit("color", {color: c, only: true}); } else { - io.to(coll).emit("color", {color: c}); + io.to(coll).emit("color", {color: c, only: false}); } }); } diff --git a/server/public/assets/js/list.js b/server/public/assets/js/list.js index cd9c1271..978dc7f7 100755 --- a/server/public/assets/js/list.js +++ b/server/public/assets/js/list.js @@ -54,23 +54,28 @@ var List = { found_array_index = 0; break; case "song_change": - if(window.location.pathname != "/") List.song_change(msg.time, msg.remove); - if(full_playlist.length > 0) { - Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); + if((offline && msg.offline_change) || !offline) { + if(window.location.pathname != "/") List.song_change(msg.time, msg.remove); + if(full_playlist.length > 0) { + Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); + } + found_array = []; + found_array_index = 0; } - found_array = []; - found_array_index = 0; break; case "changed_values": List.changedValues(msg.value); break; case "song_change_prev": - if(window.location.pathname != "/") List.song_change_prev(msg.time); - if(full_playlist.length > 0) { - Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); + if((offline && msg.offline_change) || !offline) { + + if(window.location.pathname != "/") List.song_change_prev(msg.time); + if(full_playlist.length > 0) { + Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); + } + found_array = []; + found_array_index = 0; } - found_array = []; - found_array_index = 0; break; } }, diff --git a/server/public/assets/js/listeners.js b/server/public/assets/js/listeners.js index dd28349d..2c83f4b2 100755 --- a/server/public/assets/js/listeners.js +++ b/server/public/assets/js/listeners.js @@ -227,6 +227,11 @@ $().ready(function(){ }); initializeCastApi = function() { + try { + if(cast == undefined) return; + } catch(e) { + return; + } cast.framework.CastContext.getInstance().setOptions({ receiverApplicationId: "E6856E24", autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED @@ -1159,7 +1164,7 @@ $(document).on( "click", "#add-many", function(e){ } else { try { var length = parseInt(end) - parseInt(start); - $(this).parent().parent().remove(); + $(this).parent().parent().parent().remove(); Search.submit(id, title, length, false, 0, 1, start, end); } catch(e) { Materialize.toast("Only numbers are accepted as song start and end parameters..", 3000, "red lighten"); diff --git a/server/public/assets/js/player.js b/server/public/assets/js/player.js index b1f6591d..ba0904c8 100755 --- a/server/public/assets/js/player.js +++ b/server/public/assets/js/player.js @@ -406,7 +406,7 @@ var Player = { } else { Player.loadVideoById(video_id, duration, start, end); } - List.channel_function({type:"song_change", time: time}); + List.channel_function({type:"song_change", time: time, offline_change: true}); }, playPrev: function() { @@ -444,7 +444,7 @@ var Player = { Player.loadVideoById(video_id, duration, start, end); } - List.channel_function({type:"song_change_prev", time: time}); + List.channel_function({type:"song_change_prev", time: time, offline_change: true}); }, sendNext: function(obj){ @@ -554,7 +554,7 @@ var Player = { setBGimage: function(c){ var color = c.color; - if(window.location.pathname != "/") { + if(window.location.pathname != "/" && ((offline && c.only) || (!offline && !c.only))) { document.getElementById("main-container").style.backgroundColor = Helper.rgbToHsl(color,true); $("meta[name=theme-color]").attr("content", Helper.rgbToHex(color[0], color[1], color[2])); var new_color = Helper.rgbToHex(color[0], color[1], color[2]); @@ -677,9 +677,9 @@ var Player = { if(Player.player.getCurrentTime() > Player.np.end && Player.player.getPlayerState() == YT.PlayerState.PLAYING) { end_programmatically = true; - Player.player.pauseVideo(); if(!offline) { + Player.player.pauseVideo(); socket.emit("end", {id: video_id, channel: chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)}); } else { Player.playNext();