mirror of
				https://github.com/KevinMidboe/zoff.git
				synced 2025-10-29 18:00:23 +00:00 
			
		
		
		
	tempfixes until I get my computer back
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -17,3 +17,4 @@ scripts/ | |||||||
| .DS_Store | .DS_Store | ||||||
| npm-debug.log | npm-debug.log | ||||||
| server/npm-debug.log | server/npm-debug.log | ||||||
|  | server/public/assets/dist/ | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ path = require('path'), | |||||||
| http = require('http'), | http = require('http'), | ||||||
| port = 8080, | port = 8080, | ||||||
| //farmhash = require('farmhash'), | //farmhash = require('farmhash'), | ||||||
|  | uniqid = require('uniqid'), | ||||||
| num_processes = require('os').cpus().length; | num_processes = require('os').cpus().length; | ||||||
|  |  | ||||||
| publicPath = path.join(__dirname, 'public'); | publicPath = path.join(__dirname, 'public'); | ||||||
| @@ -49,7 +50,8 @@ function startClustered(redis_enabled) { | |||||||
|         var worker_index = function(ip, len) { |         var worker_index = function(ip, len) { | ||||||
|             //console.log(ip); |             //console.log(ip); | ||||||
|             var s = ''; |             var s = ''; | ||||||
|             for (var i = 0, _len = ip.length; i < _len; i++) { |             if(ip == undefined) ip = uniqid.time(); | ||||||
|  | 	    for (var i = 0, _len = ip.length; i < _len; i++) { | ||||||
|                 if(!isNaN(ip[i])) { |                 if(!isNaN(ip[i])) { | ||||||
|                     s += ip[i]; |                     s += ip[i]; | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -191,7 +191,8 @@ margin: auto; | |||||||
| } | } | ||||||
|  |  | ||||||
| #channel-share-modal { | #channel-share-modal { | ||||||
|     background: transparent !important; | overflow:hidden;     | ||||||
|  | background: transparent !important; | ||||||
|     text-align: center !important; |     text-align: center !important; | ||||||
|     margin: auto; |     margin: auto; | ||||||
|     flex-direction: column; |     flex-direction: column; | ||||||
|   | |||||||
| @@ -23,7 +23,10 @@ var Channel = { | |||||||
|             if(cast_ready_connect || chromecastAvailable || chromecastReady) { |             if(cast_ready_connect || chromecastAvailable || chromecastReady) { | ||||||
|                 Helper.addClass(".volume-container", "volume-container-cast"); |                 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"); |             //Player.soundcloud_player = document.querySelector("#soundcloud_player"); | ||||||
|         } |         } | ||||||
|         Admin.logged_in = false; |         Admin.logged_in = false; | ||||||
| @@ -626,9 +629,12 @@ var Channel = { | |||||||
|                 url: "/", |                 url: "/", | ||||||
|                 method: "GET", |                 method: "GET", | ||||||
|                 success: function(e){ |                 success: function(e){ | ||||||
|  | 		 | ||||||
|                     if(!client) { |                     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("playpause").removeEventListener("click", Playercontrols.play_pause); | ||||||
|                         document.getElementById("fullscreen").removeEventListener("click", Playercontrols.fullscreen); |                         document.getElementById("fullscreen").removeEventListener("click", Playercontrols.fullscreen); | ||||||
|                     } |                     } | ||||||
|   | |||||||
| @@ -21,6 +21,81 @@ function removeAllListeners() { | |||||||
|     socket.removeEventListener(id); |     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) { | function getColor(id) { | ||||||
|     Helper.ajax({ |     Helper.ajax({ | ||||||
|         method: "POST", |         method: "POST", | ||||||
| @@ -556,8 +631,9 @@ function enable_host_mode(enabled) { | |||||||
|         document.removeEventListener('mozfullscreenchange', exitHandler, false); |         document.removeEventListener('mozfullscreenchange', exitHandler, false); | ||||||
|         document.removeEventListener('fullscreenchange', exitHandler, false); |         document.removeEventListener('fullscreenchange', exitHandler, false); | ||||||
|         document.removeEventListener('MSFullscreenChange', exitHandler, false); |         document.removeEventListener('MSFullscreenChange', exitHandler, false); | ||||||
|  |         resizeFunction(); | ||||||
|     } |     } | ||||||
|     List.dynamicContentPageJumpTo(-10); |     List.dynamicContentPage(-10); | ||||||
| } | } | ||||||
|  |  | ||||||
| function get_list_listener(){ | function get_list_listener(){ | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ var client = false; | |||||||
| if(domain.length > 0 && domain[0] == "client") { | if(domain.length > 0 && domain[0] == "client") { | ||||||
|     client = true; |     client = true; | ||||||
| } | } | ||||||
|  | var hiddenPlaylist = false; | ||||||
| var videoSource; | var videoSource; | ||||||
| var dynamicListeners = {}; | var dynamicListeners = {}; | ||||||
| var socket_connected = false; | var socket_connected = false; | ||||||
| @@ -392,6 +393,10 @@ addListener("click", "#player_overlay", function(event) { | |||||||
|     } |     } | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | addListener("click", "#hide-playlist", function(event) { | ||||||
|  |     this.preventDefault(); | ||||||
|  |     fullVideo(!hiddenPlaylist); | ||||||
|  | }); | ||||||
|  |  | ||||||
|  |  | ||||||
| addListener("click", "#bitcoin-address", function(event) { | addListener("click", "#bitcoin-address", function(event) { | ||||||
| @@ -919,11 +924,11 @@ addListener("click", ".donate-button", function(event) { | |||||||
|     M.Modal.getInstance(document.getElementById("donate")).open(); |     M.Modal.getInstance(document.getElementById("donate")).open(); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| /* |  | ||||||
| addListener("click", '#toast-container', function(){ | addListener("click", '#toast-container', function(){ | ||||||
|     before_toast(); |     before_toast(); | ||||||
| }); | }); | ||||||
| */ |  | ||||||
|  |  | ||||||
| addListener("click", "#aprilfools", function(){ | addListener("click", "#aprilfools", function(){ | ||||||
|     Helper.css(".mega", "-webkit-transform", "rotate(0deg)"); |     Helper.css(".mega", "-webkit-transform", "rotate(0deg)"); | ||||||
| @@ -1297,58 +1302,7 @@ window.addEventListener("focus", function(event) { | |||||||
| }); | }); | ||||||
|  |  | ||||||
| window.addEventListener("resize", function(){ | window.addEventListener("resize", function(){ | ||||||
|     if(chan && !Helper.mobilecheck()){ |     resizeFunction(); | ||||||
|         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(); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| }); | }); | ||||||
|  |  | ||||||
| addListener("click", ".result-object", function(e){ | addListener("click", ".result-object", function(e){ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user