mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Functionality up for host-client controller
This commit is contained in:
@@ -80,6 +80,7 @@
|
||||
<script type="text/javascript" src="static/js/search.js"></script>
|
||||
<script type="text/javascript" src="static/js/admin.js"></script>
|
||||
<script type="text/javascript" src="static/js/chat.js"></script>
|
||||
<script type="text/javascript" src="static/js/controller.js"></script>
|
||||
<script type="text/javascript" src="static/js/lib/materialize.js"></script>
|
||||
|
||||
<!-- Piwik tracking -->
|
||||
|
||||
@@ -114,6 +114,11 @@ io.on('connection', function(socket){
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('guid', function(arr)
|
||||
{
|
||||
io.sockets.emit(arr[0], [arr[1], arr[2]]);
|
||||
});
|
||||
|
||||
socket.on('list', function(list)
|
||||
{
|
||||
if(list !== undefined && list !== null && list != "")
|
||||
@@ -122,7 +127,8 @@ io.on('connection', function(socket){
|
||||
list = list.split(',');
|
||||
coll = list[0].toLowerCase();
|
||||
//guid = list[1];
|
||||
|
||||
socket.emit("guid", rndName(guid));
|
||||
console.log(coll);
|
||||
//console.log(name + " joined list " + coll);
|
||||
|
||||
check_inlist(coll, guid, socket, name);
|
||||
@@ -455,6 +461,22 @@ io.on('connection', function(socket){
|
||||
socket.emit("toast", "wrongpass");
|
||||
});
|
||||
|
||||
socket.on('change_channel', function()
|
||||
{
|
||||
if(in_list)
|
||||
{
|
||||
if(contains(lists[coll], guid))
|
||||
{
|
||||
//console.log(name + " left list " + coll);
|
||||
var index = lists[coll].indexOf(guid);
|
||||
lists[coll].splice(index, 1);
|
||||
io.sockets.emit(coll+",viewers", lists[coll].length);
|
||||
io.sockets.emit('chat,'+coll, [name, " left"]);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('disconnect', function()
|
||||
{
|
||||
if(in_list)
|
||||
|
||||
@@ -14,6 +14,8 @@ function chat(data)
|
||||
return;
|
||||
}
|
||||
|
||||
setup_chat_listener(chan);
|
||||
|
||||
document.getElementById("chat-btn").addEventListener("click", function(){
|
||||
console.log("clicked");
|
||||
$("#text-chat-input").focus();
|
||||
@@ -62,7 +64,9 @@ $(window).focus(function(){
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("chat,"+chan.toLowerCase(), function(data)
|
||||
function setup_chat_listener(channel)
|
||||
{
|
||||
socket.on("chat,"+channel.toLowerCase(), function(data)
|
||||
{
|
||||
if($("#chat-bar").position()["left"] != 0)
|
||||
{
|
||||
@@ -82,6 +86,7 @@ socket.on("chat,"+chan.toLowerCase(), function(data)
|
||||
$("#chatchannel li:last")[0].appendChild(in_text);
|
||||
document.getElementById("chatchannel").scrollTop = document.getElementById("chatchannel").scrollHeight
|
||||
});
|
||||
}
|
||||
|
||||
function chat_blink()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,9 @@ var paused = false;
|
||||
var playing = false;
|
||||
|
||||
//play new song
|
||||
socket.on(chan.toLowerCase()+",np", function(obj)
|
||||
function setup_youtube_listener(channel)
|
||||
{
|
||||
socket.on(channel.toLowerCase()+",np", function(obj)
|
||||
{
|
||||
console.log(obj);
|
||||
if(obj[0].length == 0){
|
||||
@@ -32,7 +34,7 @@ socket.on(chan.toLowerCase()+",np", function(obj)
|
||||
$("#player_overlay").height($("#player").height());
|
||||
if(!window.mobilecheck())
|
||||
$("#player_overlay").toggleClass("hide");
|
||||
importOldList(chan.toLowerCasettings-barse());
|
||||
importOldList(channel.toLowerCasettings-barse());
|
||||
}
|
||||
else{
|
||||
console.log("gotten new song");
|
||||
@@ -64,15 +66,17 @@ socket.on(chan.toLowerCase()+",np", function(obj)
|
||||
}
|
||||
});
|
||||
|
||||
socket.on(chan.toLowerCase()+",viewers", function(view)
|
||||
socket.on(channel.toLowerCase()+",viewers", function(view)
|
||||
{
|
||||
viewers = view;
|
||||
if(song_title !== undefined)
|
||||
getTitle(song_title, viewers);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
setup_youtube_listener(chan);
|
||||
//Materialize.toast("Passwords have been reset. If anything is not right, please send us a mail @ contact@zoff.no", 10000);
|
||||
$("#settings").sideNav({
|
||||
menuWidth: 300, // Default is 240
|
||||
|
||||
Reference in New Issue
Block a user