mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-08 20:48:48 +00:00
Offline previous song
This commit is contained in:
@@ -2034,7 +2034,7 @@ nav ul li:hover, nav ul li.active {
|
|||||||
padding: 0 2.5px;
|
padding: 0 2.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.prev.playbar, #playpause, #volume-button
|
.margin-playbar, #volume-button
|
||||||
{
|
{
|
||||||
margin-left:10px;
|
margin-left:10px;
|
||||||
}
|
}
|
||||||
|
|||||||
2
server/public/assets/dist/embed.min.js
vendored
2
server/public/assets/dist/embed.min.js
vendored
File diff suppressed because one or more lines are too long
2
server/public/assets/dist/main.min.js
vendored
2
server/public/assets/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -136,6 +136,15 @@ var List = {
|
|||||||
found_array_index = 0;
|
found_array_index = 0;
|
||||||
//if(!w_p) List.dragging(true);
|
//if(!w_p) List.dragging(true);
|
||||||
break;
|
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});
|
||||||
|
}
|
||||||
|
found_array = [];
|
||||||
|
found_array_index = 0;
|
||||||
|
//if(!w_p) List.dragging(true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -204,6 +213,7 @@ var List = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
List.sortList();
|
List.sortList();
|
||||||
|
|
||||||
$("#wrapper").empty();
|
$("#wrapper").empty();
|
||||||
|
|
||||||
Helper.log("---------------------------");
|
Helper.log("---------------------------");
|
||||||
@@ -496,6 +506,25 @@ var List = {
|
|||||||
List.insertAtIndex(song_voted_on, false);
|
List.insertAtIndex(song_voted_on, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
song_change_prev: function(time) {
|
||||||
|
full_playlist[full_playlist.length - 1].now_playing = false;
|
||||||
|
full_playlist[full_playlist.length - 1].votes = full_playlist[0].votes;
|
||||||
|
full_playlist[full_playlist.length - 1].guids = [];
|
||||||
|
full_playlist[full_playlist.length - 1].added = full_playlist[0].added - 1;
|
||||||
|
|
||||||
|
full_playlist.unshift(full_playlist.pop());
|
||||||
|
|
||||||
|
full_playlist[full_playlist.length - 1].now_playing = true;
|
||||||
|
$("#wrapper").children()[$("#wrapper").children().length - 1].remove();
|
||||||
|
|
||||||
|
var length = full_playlist.length - 2;
|
||||||
|
if(length < 0) {
|
||||||
|
length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
List.insertAtIndex(full_playlist[0], false, true);
|
||||||
|
},
|
||||||
|
|
||||||
song_change: function(time, remove) {
|
song_change: function(time, remove) {
|
||||||
try{
|
try{
|
||||||
var length = full_playlist.length - 1;
|
var length = full_playlist.length - 1;
|
||||||
@@ -539,11 +568,15 @@ var List = {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
skip: function() {
|
skip: function(way) {
|
||||||
if(!offline){
|
if(!offline){
|
||||||
socket.emit('skip', {pass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), id:video_id, channel: chan.toLowerCase(), userpass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
|
socket.emit('skip', {pass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), id:video_id, channel: chan.toLowerCase(), userpass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
|
||||||
} else {
|
} else {
|
||||||
|
if(way) {
|
||||||
Player.playNext();
|
Player.playNext();
|
||||||
|
} else {
|
||||||
|
Player.playPrev();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -787,6 +787,9 @@ function change_offline(enabled, already_offline){
|
|||||||
}
|
}
|
||||||
//$(".list-remove").removeClass("hide");
|
//$(".list-remove").removeClass("hide");
|
||||||
$("#viewers").addClass("hide");
|
$("#viewers").addClass("hide");
|
||||||
|
$(".margin-playbar").removeClass("margin-playbar");
|
||||||
|
$(".prev.playbar").addClass("margin-playbar");
|
||||||
|
$(".prev.playbar").removeClass("hide");
|
||||||
$("#offline-mode").removeClass("waves-cyan");
|
$("#offline-mode").removeClass("waves-cyan");
|
||||||
$("#offline-mode").addClass("cyan");
|
$("#offline-mode").addClass("cyan");
|
||||||
if(!Helper.mobilecheck()) {
|
if(!Helper.mobilecheck()) {
|
||||||
@@ -844,7 +847,10 @@ function change_offline(enabled, already_offline){
|
|||||||
list_html = $("<div>" + list_html + "</div>");
|
list_html = $("<div>" + list_html + "</div>");
|
||||||
list_html = list_html.html();
|
list_html = list_html.html();
|
||||||
}
|
}
|
||||||
|
$(".margin-playbar").removeClass("margin-playbar");
|
||||||
|
$("#playpause").addClass("margin-playbar");
|
||||||
$("#viewers").removeClass("hide");
|
$("#viewers").removeClass("hide");
|
||||||
|
$(".prev.playbar").addClass("hide");
|
||||||
$("#offline-mode").addClass("waves-cyan");
|
$("#offline-mode").addClass("waves-cyan");
|
||||||
$("#offline-mode").removeClass("cyan");
|
$("#offline-mode").removeClass("cyan");
|
||||||
if(!Helper.mobilecheck()) {
|
if(!Helper.mobilecheck()) {
|
||||||
|
|||||||
@@ -303,6 +303,30 @@ var Player = {
|
|||||||
List.channel_function({type:"song_change", time: time});
|
List.channel_function({type:"song_change", time: time});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
playPrev: function() {
|
||||||
|
var length = full_playlist.length - 2;
|
||||||
|
if(length < 0) {
|
||||||
|
length = 0;
|
||||||
|
}
|
||||||
|
var next_song = full_playlist[length];
|
||||||
|
video_id = next_song.id;
|
||||||
|
time = (new Date()).getTime();
|
||||||
|
song_title = next_song.title;
|
||||||
|
duration = next_song.duration;
|
||||||
|
Player.getTitle(song_title, viewers);
|
||||||
|
Player.setBGimage(video_id);
|
||||||
|
|
||||||
|
if(chromecastAvailable){
|
||||||
|
castSession.sendMessage("urn:x-cast:zoff.me", {type: "loadVideo", videoId: video_id, channel: chan.toLowerCase()});
|
||||||
|
chrome.cast.media.GenericMediaMetadata({metadataType: "GENERIC", title:song_title, image: 'https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg'});
|
||||||
|
chrome.cast.Image('https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg');
|
||||||
|
} else {
|
||||||
|
Player.loadVideoById(video_id, duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
List.channel_function({type:"song_change_prev", time: time});
|
||||||
|
},
|
||||||
|
|
||||||
sendNext: function(obj){
|
sendNext: function(obj){
|
||||||
if(chromecastAvailable){
|
if(chromecastAvailable){
|
||||||
castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", title: obj.title, videoId: obj.videoId});
|
castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", title: obj.title, videoId: obj.videoId});
|
||||||
|
|||||||
@@ -193,10 +193,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="controls" class="noselect">
|
<div id="controls" class="noselect">
|
||||||
<!--<a class="playbar-btn prev playbar" href="#prev">
|
<a class="playbar-btn prev playbar hide" href="#prev">
|
||||||
<i class="material-icons">skip_previous</i>
|
<i class="material-icons">skip_previous</i>
|
||||||
</a>-->
|
</a>
|
||||||
<div id="playpause" class="playbar-btn">
|
<div id="playpause" class="playbar-btn margin-playbar">
|
||||||
<i id="play" class="material-icons hide">play_arrow</i>
|
<i id="play" class="material-icons hide">play_arrow</i>
|
||||||
<i id="pause" class="material-icons">pause</i>
|
<i id="pause" class="material-icons">pause</i>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user