Fixed bug where tabs change when another user joins the channel

This commit is contained in:
Kasper Rynning-Tønnesen
2016-04-20 12:54:22 +02:00
parent 68f998a69e
commit b4c3395b0d
4 changed files with 18 additions and 24 deletions

File diff suppressed because one or more lines are too long

View File

@@ -89,10 +89,10 @@ var Admin = {
//$("#wrapper").toggleClass("tabs_height");
//}
$('ul.playlist-tabs-loggedIn').tabs('select_tab', 'wrapper');
if(!Helper.contains($("#admin-lock").attr("class").split(" "), "mdi-action-lock-open"))
$("#admin-lock").addClass("mdi-action-lock-open clickable");
$('ul.playlist-tabs-loggedIn').tabs('select_tab', $(".playlist-tabs li a.active").attr("href").substring(1));
});
socket.on("conf", function(msg)
@@ -155,9 +155,14 @@ var Admin = {
$(".card-action").addClass("hide");
}
$('ul.playlist-tabs').tabs('select_tab', 'wrapper');
$('ul.playlist-tabs-loggedIn').tabs('select_tab', 'wrapper');
//$("#wrapper").removeClass("tabs_height");
if($(".playlist-tabs-li a.active").attr("href") == "#suggestions")
{
$('ul.playlist-tabs').tabs('select_tab', 'wrapper');
$('ul.playlist-tabs-loggedIn').tabs('select_tab', 'wrapper');
$("#wrapper").removeClass("tabs_height");
} else {
$('ul.playlist-tabs').tabs('select_tab', $(".playlist-tabs-loggedIn li a.active").attr("href").substring(1));
}
$("#admin-lock").removeClass("mdi-action-lock-open clickable");
$("#password").attr("placeholder", "Enter channel password");
//$("#top-button").removeClass("top-button-with-tabs");

View File

@@ -37,14 +37,13 @@ var Chat = {
//$("#chat-btn").css("color", "grey");
console.log(inp.indexOf("changed name to"));
if(!blink_interval_exists && inp.indexOf("changed name to") < 0 && !chat_active)
{
$("#favicon").attr("href", "static/images/highlogo.png");
blink_interval_exists = true;
unseen = true;
blink_interval = setInterval(Chat.chat_blink, 2000);
chat_unseen = true;
//blink_interval = setTimeout(Chat.chat_blink, 2000);
}
if(document.hidden)
@@ -74,7 +73,8 @@ var Chat = {
{
$("#favicon").attr("href", "static/images/highlogo.png");
unseen = true;
blink_interval = setTimeout(Chat.chat_blink, 1000);
chat_unseen = true;
//blink_interval = setTimeout(Chat.chat_blink, 1000);
}
var color = Helper.intToARGB(Helper.hashCode(data[0]));
@@ -90,19 +90,6 @@ var Chat = {
$("#chatchannel li:last")[0].appendChild(in_text);
document.getElementById("chatchannel").scrollTop = document.getElementById("chatchannel").scrollHeight;
});
},
chat_blink: function()
{
console.log("chat_blink");
$(".chat-link").css("color", "red");
setTimeout(function(){
$(".chat-link").css("color", "white");
if(unseen){
Chat.chat_blink();
}
}, 1000);
}
}

View File

@@ -27,6 +27,7 @@ var embed = false;
var autoplay = true;
var durationBegun = false;
var chat_active = false;
var chat_unseen = false;
var result_html;
var empty_results_html;
@@ -327,6 +328,7 @@ $(document).on("submit", "#adminForm", function(e){
$(document).on("click", ".chat-link", function(e){
chat_active = true;
unseen = false;
chat_unseen = false;
$("#favicon").attr("href", "static/images/favicon.png");
$("#chatPlaylist").css("display", "block");
$("#wrapper").css("display", "none");