Fixed errors with turning of remote capabilities and listeners on adminsettings

This commit is contained in:
Kasper Rynning-Tønnesen
2016-05-11 14:34:21 +02:00
parent 83602836ed
commit d05a183ffe
4 changed files with 42 additions and 38 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -20,9 +20,12 @@ var Hostcontroller = {
if(!began)
{
began = true;
socket.on(id, function(arr)
{
setup_host_listener(id);
}
},
host_on_action: function(arr)
{
if(enabled){
if(arr[0] == "volume"){
$("#volume").slider("value", arr[1]);
@@ -30,7 +33,6 @@ var Hostcontroller = {
localStorage.setItem("volume", arr[1]);
Playercontrols.choose_button(arr[1], false);
}else if(arr[0] == "channel"){
console.log("changing channel");
socket.emit("change_channel");
Admin.beginning = true;
@@ -52,8 +54,6 @@ var Hostcontroller = {
else if(arr[0] == "skip")
List.skip();
}
});
}
},
change_enabled:function(val){

View File

@@ -167,7 +167,7 @@ function init(){
setup_admin_listener();
setup_list_listener();
setup_chat_listener();
if(!Helper.mobilecheck() && $("#alreadychannel").length == 0) setup_host_listener();
if(!Helper.mobilecheck() && $("#alreadychannel").length == 0) setup_host_initialization();
if(!Helper.msieversion()) Notification.requestPermission();
@@ -230,10 +230,14 @@ function setup_playlist_listener(){
socket.on('playlists', Nochan.frontpage_function);
}
function setup_host_listener(){
function setup_host_initialization(){
socket.on("id", Hostcontroller.host_listener);
}
function setup_host_listener(id){
socket.on(id, Hostcontroller.host_on_action);
}
$(document).keyup(function(e) {
if(event.keyCode == 27){
$("#results").html("");
@@ -308,13 +312,13 @@ $(document).on("submit", "#base", function(e){
});
$('input[class=remote_switch_class]').change(function()
$(document).on("change", 'input[class=remote_switch_class]', function()
{
enabled = document.getElementsByName("remote_switch")[0].checked;
Hostcontroller.change_enabled(document.getElementsByName("remote_switch")[0].checked);
Crypt.set_remote(enabled);
});
$('input[class=conf]').change(function()
$(document).on("change", 'input[class=conf]', function()
{
Admin.save();
});