mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Merge branch 'master' of github.com:zoff-music/zoff
This commit is contained in:
@@ -23,7 +23,10 @@ var Channel = {
|
||||
if(cast_ready_connect || chromecastAvailable || chromecastReady) {
|
||||
Helper.addClass(".volume-container", "volume-container-cast");
|
||||
}
|
||||
|
||||
if(!embed) {
|
||||
document.querySelector("#main-container").insertAdjacentHTML("beforeend", "<a id='hide-playlist' class='hide-on-small-only' href='#!' style=' position: absolute;top: 128px;background: inherit;display:flex;align:items:center;justify-content:center;z-index: 99;font-size: 1rem;padding: 10px;color: white;'><i class='material-icons'>keyboard_arrow_right</i></div>");
|
||||
document.querySelector("#hide-playlist").style.left = (document.querySelector("#video-container").offsetWidth - document.querySelector("#hide-playlist").offsetWidth) + "px";
|
||||
}
|
||||
//Player.soundcloud_player = document.querySelector("#soundcloud_player");
|
||||
}
|
||||
Admin.logged_in = false;
|
||||
@@ -279,8 +282,9 @@ var Channel = {
|
||||
|
||||
}
|
||||
|
||||
if(!Helper.msieversion() && !Helper.mobilecheck() && !client) Notification.requestPermission();
|
||||
|
||||
try {
|
||||
if(!Helper.msieversion() && !Helper.mobilecheck() && !client && Notification != undefined) Notification.requestPermission();
|
||||
}catch(e){}
|
||||
document.getElementsByClassName("search_input")[0].focus();
|
||||
|
||||
Helper.sample();
|
||||
@@ -626,9 +630,12 @@ var Channel = {
|
||||
url: "/",
|
||||
method: "GET",
|
||||
success: function(e){
|
||||
|
||||
|
||||
if(!client) {
|
||||
document.getElementById("volume-button").removeEventListener("click", Playercontrols.mute_video);
|
||||
document.querySelector("#hide-playlist").remove();
|
||||
if(hiddenPlaylist) document.querySelector("main").style.maxWidth = "";
|
||||
hiddenPlaylist = false;
|
||||
document.getElementById("volume-button").removeEventListener("click", Playercontrols.mute_video);
|
||||
document.getElementById("playpause").removeEventListener("click", Playercontrols.play_pause);
|
||||
document.getElementById("fullscreen").removeEventListener("click", Playercontrols.fullscreen);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,81 @@ function removeAllListeners() {
|
||||
socket.removeEventListener(id);
|
||||
}
|
||||
|
||||
function resizeFunction() {
|
||||
if(chan && !Helper.mobilecheck()){
|
||||
if(!client && !embed) document.querySelector("#hide-playlist").style.left = (document.querySelector("#video-container").offsetWidth - document.querySelector("#hide-playlist").offsetWidth) + "px";
|
||||
if(document.querySelector("#wrapper") == null) return;
|
||||
if(window.innerWidth > 600 && document.querySelector("#wrapper").style.height != "") {
|
||||
document.querySelector("#wrapper").style.height = "";
|
||||
document.querySelector("#chat-bar").style.height = "";
|
||||
document.querySelector("#channelchat").style.height = "";
|
||||
document.querySelector("#all_chat").style.height = "";
|
||||
document.querySelector("#chat-container").style.height = "";
|
||||
} else if(window.innerWidth < 601) {
|
||||
if(!client && !embed) {
|
||||
var scPlaying = false;
|
||||
var ytPlaying = false;
|
||||
try {
|
||||
ytPlaying = Player.player.getPlayerState() == YT.PlayerState.PLAYING || Player.player.getPlayerState() == YT.PlayerState.BUFFERING;
|
||||
} catch(e) {}
|
||||
try {
|
||||
scPlaying = Player.soundcloud_player.isPlaying();
|
||||
} catch(e){}
|
||||
resizePlaylistPlaying(ytPlaying || scPlaying);
|
||||
return;
|
||||
}
|
||||
}
|
||||
var temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71)+1;
|
||||
if(temp_fit > List.can_fit || temp_fit < List.can_fit){
|
||||
List.dynamicContentPage(-10);
|
||||
}
|
||||
if(List.can_fit < temp_fit){
|
||||
for(var i = 0; i < List.page + temp_fit; i++) {
|
||||
Helper.css(document.querySelector("#wrapper").children[i], "display", "inline-flex");
|
||||
}
|
||||
} else if(List.can_fit > temp_fit){
|
||||
Helper.css(document.querySelector("#wrapper").children[List.page + temp_fit], "display", "none");
|
||||
var elements = document.querySelector("#wrapper").children;
|
||||
for(var i = List.page + temp_fit; i < elements.length; i++) {
|
||||
Helper.css(document.querySelector("#wrapper").children[i], "display", "none");
|
||||
}
|
||||
}
|
||||
List.can_fit = temp_fit;
|
||||
List.element_height = (Helper.computedStyle("#wrapper", "height") / List.can_fit)-5.3;
|
||||
|
||||
Helper.css(".list-song", "height", List.element_height + "px");
|
||||
Channel.set_title_width();
|
||||
if(!client) {
|
||||
var controlsPosition = document.querySelector("#controls").offsetHeight - Helper.computedStyle("#controls", "height");
|
||||
if(document.querySelectorAll("#controls").length > 0 && !Helper.mobilecheck()) {
|
||||
Helper.css(document.querySelector("#seekToDuration"), "top", controlsPosition - 55);
|
||||
} else if(document.querySelectorAll("#controls").length > 0) {
|
||||
Helper.css(document.querySelector("#seekToDuration"), "top", controlsPosition - 20);
|
||||
}
|
||||
Channel.window_width_volume_slider();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fullVideo(hide) {
|
||||
if(hide) {
|
||||
document.querySelector("#playlist").className += " show-only-mobile";
|
||||
document.querySelector("#video-container").classList.remove("m9");
|
||||
document.querySelector("#video-container").className += " m12";
|
||||
document.querySelector("main").style.maxWidth = "100%";
|
||||
document.querySelector("#hide-playlist").style.left = (document.querySelector("#video-container").offsetWidth - document.querySelector("#hide-playlist").offsetWidth) + "px";
|
||||
document.querySelector("#hide-playlist .material-icons").innerText = "keyboard_arrow_left";
|
||||
} else {
|
||||
document.querySelector("#playlist").classList.remove("show-only-mobile");
|
||||
document.querySelector("#video-container").classList.remove("m12");
|
||||
document.querySelector("#video-container").className += " m9";
|
||||
document.querySelector("main").style.maxWidth = "99%";
|
||||
document.querySelector("#hide-playlist").style.left = (document.querySelector("#video-container").offsetWidth - document.querySelector("#hide-playlist").offsetWidth) + "px";
|
||||
document.querySelector("#hide-playlist .material-icons").innerText = "keyboard_arrow_right";
|
||||
}
|
||||
hiddenPlaylist = hide;
|
||||
}
|
||||
|
||||
function getColor(id) {
|
||||
Helper.ajax({
|
||||
method: "POST",
|
||||
@@ -556,8 +631,9 @@ function enable_host_mode(enabled) {
|
||||
document.removeEventListener('mozfullscreenchange', exitHandler, false);
|
||||
document.removeEventListener('fullscreenchange', exitHandler, false);
|
||||
document.removeEventListener('MSFullscreenChange', exitHandler, false);
|
||||
resizeFunction();
|
||||
}
|
||||
List.dynamicContentPageJumpTo(-10);
|
||||
List.dynamicContentPage(-10);
|
||||
}
|
||||
|
||||
function get_list_listener(){
|
||||
@@ -847,6 +923,16 @@ function pagination_results(e) {
|
||||
|
||||
function handleEvent(e, target, tried, type) {
|
||||
var path = e.path || (e.composedPath && e.composedPath());
|
||||
if(!path) {
|
||||
var path = [target];
|
||||
var parent = target.parentElement;
|
||||
while(parent != null) {
|
||||
path.push(parent);
|
||||
try {
|
||||
parent = parent.parentElement;
|
||||
} catch(e){break;}
|
||||
}
|
||||
}
|
||||
if(path) {
|
||||
for(var y = 0; y < path.length; y++) {
|
||||
var target = path[y];
|
||||
|
||||
@@ -6,6 +6,7 @@ if(domain.length > 0 && domain[0] == "client") {
|
||||
client = true;
|
||||
}
|
||||
var local_new_channel = false;
|
||||
var hiddenPlaylist = false;
|
||||
var videoSource;
|
||||
var dynamicListeners = {};
|
||||
var socket_connected = false;
|
||||
@@ -393,6 +394,10 @@ addListener("click", "#player_overlay", function(event) {
|
||||
}
|
||||
});
|
||||
|
||||
addListener("click", "#hide-playlist", function(event) {
|
||||
this.preventDefault();
|
||||
fullVideo(!hiddenPlaylist);
|
||||
});
|
||||
|
||||
|
||||
addListener("click", "#bitcoin-address", function(event) {
|
||||
@@ -920,11 +925,11 @@ addListener("click", ".donate-button", function(event) {
|
||||
M.Modal.getInstance(document.getElementById("donate")).open();
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
addListener("click", '#toast-container', function(){
|
||||
before_toast();
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
addListener("click", "#aprilfools", function(){
|
||||
Helper.css(".mega", "-webkit-transform", "rotate(0deg)");
|
||||
@@ -1298,57 +1303,7 @@ window.addEventListener("focus", function(event) {
|
||||
});
|
||||
|
||||
window.addEventListener("resize", function(){
|
||||
if(chan && !Helper.mobilecheck()){
|
||||
if(document.querySelector("#wrapper") == null) return;
|
||||
if(window.innerWidth > 600 && document.querySelector("#wrapper").style.height != "") {
|
||||
document.querySelector("#wrapper").style.height = "";
|
||||
document.querySelector("#chat-bar").style.height = "";
|
||||
document.querySelector("#channelchat").style.height = "";
|
||||
document.querySelector("#all_chat").style.height = "";
|
||||
document.querySelector("#chat-container").style.height = "";
|
||||
} else if(window.innerWidth < 601) {
|
||||
if(!client && !embed) {
|
||||
var scPlaying = false;
|
||||
var ytPlaying = false;
|
||||
try {
|
||||
ytPlaying = Player.player.getPlayerState() == YT.PlayerState.PLAYING || Player.player.getPlayerState() == YT.PlayerState.BUFFERING;
|
||||
} catch(e) {}
|
||||
try {
|
||||
scPlaying = Player.soundcloud_player.isPlaying();
|
||||
} catch(e){}
|
||||
resizePlaylistPlaying(ytPlaying || scPlaying);
|
||||
return;
|
||||
}
|
||||
}
|
||||
var temp_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71)+1;
|
||||
if(temp_fit > List.can_fit || temp_fit < List.can_fit){
|
||||
List.dynamicContentPage(-10);
|
||||
}
|
||||
if(List.can_fit < temp_fit){
|
||||
for(var i = 0; i < List.page + temp_fit; i++) {
|
||||
Helper.css(document.querySelector("#wrapper").children[i], "display", "inline-flex");
|
||||
}
|
||||
} else if(List.can_fit > temp_fit){
|
||||
Helper.css(document.querySelector("#wrapper").children[List.page + temp_fit], "display", "none");
|
||||
var elements = document.querySelector("#wrapper").children;
|
||||
for(var i = List.page + temp_fit; i < elements.length; i++) {
|
||||
Helper.css(document.querySelector("#wrapper").children[i], "display", "none");
|
||||
}
|
||||
}
|
||||
List.can_fit = temp_fit;
|
||||
List.element_height = (Helper.computedStyle("#wrapper", "height") / List.can_fit)-5.3;
|
||||
Helper.css(".list-song", "height", List.element_height + "px");
|
||||
Channel.set_title_width();
|
||||
if(!client) {
|
||||
var controlsPosition = document.querySelector("#controls").offsetHeight - Helper.computedStyle("#controls", "height");
|
||||
if(document.querySelectorAll("#controls").length > 0 && !Helper.mobilecheck()) {
|
||||
Helper.css(document.querySelector("#seekToDuration"), "top", controlsPosition - 55);
|
||||
} else if(document.querySelectorAll("#controls").length > 0) {
|
||||
Helper.css(document.querySelector("#seekToDuration"), "top", controlsPosition - 20);
|
||||
}
|
||||
Channel.window_width_volume_slider();
|
||||
}
|
||||
}
|
||||
resizeFunction();
|
||||
});
|
||||
|
||||
addListener("click", ".result-object", function(e){
|
||||
|
||||
@@ -822,7 +822,8 @@ var Player = {
|
||||
|
||||
notifyUser: function(id, title) {
|
||||
title = title.replace(/\\\'/g, "'").replace(/"/g,"'").replace(/&/g,"&");
|
||||
if (Notification.permission === "granted" && document.hidden && !embed) {
|
||||
try{
|
||||
if (Notification != undefined && Notification.permission === "granted" && document.hidden && !embed) {
|
||||
var icon = "https://img.youtube.com/vi/"+id+"/mqdefault.jpg";
|
||||
if(videoSource) icon = full_playlist[full_playlist.length - 1].thumbnail;
|
||||
var notification = new Notification("Now Playing", {body: title, icon: icon, iconUrl: icon});
|
||||
@@ -831,6 +832,7 @@ var Player = {
|
||||
notification.close();
|
||||
},5000);
|
||||
}
|
||||
}catch(e){}
|
||||
},
|
||||
|
||||
setup_all_listeners: function() {
|
||||
|
||||
@@ -155,8 +155,8 @@ var Search = {
|
||||
Helper.addClass(".prev-results-button", "disabled");
|
||||
}
|
||||
|
||||
document.querySelector(".pagination-results a").setAttribute("data-original-search", search_input);
|
||||
|
||||
document.querySelectorAll(".pagination-results a")[0].setAttribute("data-original-search", search_input);
|
||||
document.querySelectorAll(".pagination-results a")[1].setAttribute("data-original-search", search_input);
|
||||
//setTimeout(function(){$(".thumb").lazyload({container: $("#results")});}, 250);
|
||||
|
||||
Helper.removeClass(".search_loader_spinner", "active");
|
||||
|
||||
Reference in New Issue
Block a user