From ec2a5b07ffa6431ca9d98b019ed6ce4e754bd88d Mon Sep 17 00:00:00 2001 From: Maximilian Mader Date: Mon, 17 Mar 2014 22:04:46 +0100 Subject: [PATCH] Fix topic hiding mechanism --- file/js/be.bastelstu.Chat.litcoffee | 31 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/file/js/be.bastelstu.Chat.litcoffee b/file/js/be.bastelstu.Chat.litcoffee index d5c94d2..27d5ea5 100644 --- a/file/js/be.bastelstu.Chat.litcoffee +++ b/file/js/be.bastelstu.Chat.litcoffee @@ -43,6 +43,8 @@ exposed by a function if necessary. available: {} hiddenTopics = {} + hidePrivateChannelTopic = no + isJoining = no fileUploaded = no errorVisible = false @@ -349,12 +351,14 @@ Toggle checkboxes. Hide topic container. $('#timsChatTopicCloser').on 'click', -> - unless hiddenTopics[roomList.active.roomID]? + if openChannel is 0 hiddenTopics[roomList.active.roomID] = true + else + hidePrivateChannelTopic = yes - $('#timsChatTopic').addClass 'invisible' - do $(window).resize - + $('#timsChatTopic').addClass 'invisible' + do $(window).resize + Close private channels $('#timsChatMessageTabMenu').on 'click', '.jsChannelCloser', -> closePrivateChannel $(@).parent().data 'userID' @@ -899,11 +903,12 @@ Joins a room. loading = false roomList.active = data.returnValues - $('#timsChatTopic > .topic').text roomList.active.topic - if roomList.active.topic.trim() is '' or hiddenTopics[roomList.active.roomID]? - $('#timsChatTopic').addClass 'invisible' - else - $('#timsChatTopic').removeClass 'invisible' + if openChannel is 0 + $('#timsChatTopic > .topic').text roomList.active.topic + if roomList.active.topic.trim() is '' or hiddenTopics[roomList.active.roomID]? + $('#timsChatTopic').addClass 'invisible' + else + $('#timsChatTopic').removeClass 'invisible' $('.timsChatMessage').addClass 'unloaded' @@ -944,7 +949,11 @@ Open private channel $('.timsChatMessageContainer').height $('.timsChatMessageContainer').height() if userID isnt 0 - $('#timsChatTopic').removeClass 'invisible' + if hidePrivateChannelTopic + $('#timsChatTopic').addClass 'invisible' + else + $('#timsChatTopic').removeClass 'invisible' + $('#timsChatTopic > .topic').html WCF.Language.get 'chat.global.privateChannelTopic', {username: userList.allTime[userID].username} $('#timsChatMessageTabMenu').removeClass 'singleTab' @@ -969,7 +978,7 @@ Open private channel WCF.System.FlexibleMenu.rebuild $('#timsChatMessageTabMenu > .tabMenu').attr 'id' else $('#timsChatTopic > .topic').text roomList.active.topic - if roomList.active.topic.trim() is '' + if roomList.active.topic.trim() is '' or hiddenTopics[roomList.active.roomID]? $('#timsChatTopic').addClass 'invisible' else $('#timsChatTopic').removeClass 'invisible'