1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Closing of private channels is now possible,

add notifications to private channel tab menu (style is just a placeholder
right now)
This commit is contained in:
Maximilian Mader 2013-07-24 12:55:47 +02:00
parent de96de5941
commit a0cf213e48
4 changed files with 59 additions and 15 deletions

View File

@ -36,7 +36,7 @@ exposed by a function if necessary.
userList = userList =
current: {} current: {}
allTime: {} allTime: {}
currentRoom = {}
errorVisible = false errorVisible = false
inputErrorHidingTimer = null inputErrorHidingTimer = null
@ -279,8 +279,11 @@ Toggle checkboxes.
Hide topic container. Hide topic container.
$('.jsTopicCloser').on 'click', -> $('.jsTopicCloser').on 'click', ->
$('#timsChatTopic').addClass 'hidden' if $('.timsChatMessageContainer.active').data('userID') is 0
$('#timsChatTopic').addClass 'hidden'
else
closePrivateChannel $('.timsChatMessageContainer.active').data('userID')
Visibly mark the message once the associated checkbox is checked. Visibly mark the message once the associated checkbox is checked.
$(document).on 'click', '.timsChatMessage :checkbox', (event) -> $(document).on 'click', '.timsChatMessage :checkbox', (event) ->
@ -450,10 +453,10 @@ Insert the given messages into the chat stream.
$('.timsChatMessageContainer.active').trigger 'scroll' $('.timsChatMessageContainer.active').trigger 'scroll'
for message in messages for message in messages
message.isInPrivateChannel = (String(message.type) is v.config.messageTypes.WHISPER) and ($.wcfIsset("timsChatMessageContainer#{message.receiver}") or $.wcfIsset("timsChatMessageContainer#{message.sender}"))
events.newMessage.fire message events.newMessage.fire message
message.isInPrivateChannel = (String(message.type) is v.config.messageTypes.WHISPER) and ($.wcfIsset("timsChatMessageContainer#{message.receiver}") or $.wcfIsset("timsChatMessageContainer#{message.sender}"))
createNewMessage = yes createNewMessage = yes
if $('.timsChatMessage:last-child .text').is('ul') and lastMessage isnt null and lastMessage.type in [ 0, 7 ] if $('.timsChatMessage:last-child .text').is('ul') and lastMessage isnt null and lastMessage.type in [ 0, 7 ]
if lastMessage.type is message.type and lastMessage.sender is message.sender and lastMessage.receiver is message.receiver and lastMessage.isInPrivateChannel is message.isInPrivateChannel if lastMessage.type is message.type and lastMessage.sender is message.sender and lastMessage.receiver is message.receiver and lastMessage.isInPrivateChannel is message.isInPrivateChannel
@ -598,6 +601,17 @@ Send out notifications for the given `message`. The number of unread messages wi
if scrollUpNotifications if scrollUpNotifications
$('.timsChatMessageContainer.active').addClass 'notification' $('.timsChatMessageContainer.active').addClass 'notification'
if message.isInPrivateChannel
if message.sender is WCF.User.userID
privateChannelID = message.receiver
else
privateChannelID = message.sender
if $('.timsChatMessageContainer.active').data('userID') isnt privateChannelID
$("#privateChannel#{privateChannelID}").addClass 'notify'
else if $('.timsChatMessageContainer.active').data('userID') isnt 0
$("#privateChannel0").addClass 'notify'
return if isActive or $('#timsChatNotify').data('status') is 0 return if isActive or $('#timsChatNotify').data('status') is 0
document.title = v.titleTemplate.fetch document.title = v.titleTemplate.fetch
@ -693,17 +707,19 @@ Joins a room.
loading = false loading = false
$('#timsChatTopic').removeClass 'hidden' $('#timsChatTopic').removeClass 'hidden'
currentRoom = data.returnValues
currentRoom.roomID = roomID
$('#timsChatTopic > .topic').text data.returnValues.topic $('#timsChatTopic > .topic').text currentRoom.topic
if data.returnValues.topic.trim() is '' if currentRoom.topic.trim() is ''
$('#timsChatTopic').addClass 'empty' $('#timsChatTopic').addClass 'empty'
else else
$('#timsChatTopic').removeClass 'empty' $('#timsChatTopic').removeClass 'empty'
$('.timsChatMessage').addClass 'unloaded' $('.timsChatMessage').addClass 'unloaded'
document.title = v.titleTemplate.fetch data.returnValues document.title = v.titleTemplate.fetch currentRoom
handleMessages data.returnValues.messages handleMessages currentRoom.messages
do getMessages do getMessages
do refreshRoomList do refreshRoomList
failure: -> failure: ->
@ -721,6 +737,7 @@ Open private channel
div = $ '<div>' div = $ '<div>'
div.attr 'id', "timsChatMessageContainer#{userID}" div.attr 'id', "timsChatMessageContainer#{userID}"
div.data 'userID', userID
div.addClass 'timsChatMessageContainer' div.addClass 'timsChatMessageContainer'
div.addClass 'marginTop' div.addClass 'marginTop'
div.addClass 'container' div.addClass 'container'
@ -729,6 +746,10 @@ Open private channel
$('.privateChannel').removeClass 'active' $('.privateChannel').removeClass 'active'
if userID isnt 0 if userID isnt 0
$('#timsChatTopic').removeClass 'hidden empty'
$('#timsChatTopic > .topic').text WCF.Language.get 'chat.general.privateChannelTopic', {username: userList.allTime[userID].username}
$('#timsChatTopic > .jsTopicCloser').attr 'title', WCF.Language.get 'chat.general.closePrivateChannel'
unless $.wcfIsset "privateChannel#{userID}" unless $.wcfIsset "privateChannel#{userID}"
li = $ '<li>' li = $ '<li>'
li.attr 'id', "privateChannel#{userID}" li.attr 'id', "privateChannel#{userID}"
@ -751,13 +772,20 @@ Open private channel
$('#privateChannelsMenu ul').append li $('#privateChannelsMenu ul').append li
do WCF.DOMNodeInsertedHandler.execute
$('#privateChannelsMenu').addClass 'shown' $('#privateChannelsMenu').addClass 'shown'
else
$('#timsChatTopic > .topic').text currentRoom.topic
$('#timsChatTopic > .jsTopicCloser').attr 'title', WCF.Language.get 'chat.general.closeTopic'
if currentRoom.topic.trim() is ''
$('#timsChatTopic').addClass 'empty'
else
$('#timsChatTopic').removeClass 'empty'
do WCF.DOMNodeInsertedHandler.execute
$('.timsChatMessageContainer').removeClass 'active' $('.timsChatMessageContainer').removeClass 'active'
$("#timsChatMessageContainer#{userID}").addClass 'active' $("#timsChatMessageContainer#{userID}").addClass 'active'
$("#privateChannel#{userID}").addClass 'active' $("#privateChannel#{userID}").addClass('active').removeClass 'notify'
openChannel = userID openChannel = userID
Close private channel Close private channel

View File

@ -139,6 +139,15 @@
} }
} }
} }
&.notify {
> .userAvatar {
> * {
// TODO
opacity: .4;
}
}
}
} }
} }
} }

View File

@ -137,6 +137,10 @@
<item name="chat.general.information"><![CDATA[Information]]></item> <item name="chat.general.information"><![CDATA[Information]]></item>
<item name="chat.general.information.chatUpdate"><![CDATA[Der Chat wurde aktualisiert. Bitte laden Sie die Seite neu, da es sonst zu Fehlern kommen kann.]]></item> <item name="chat.general.information.chatUpdate"><![CDATA[Der Chat wurde aktualisiert. Bitte laden Sie die Seite neu, da es sonst zu Fehlern kommen kann.]]></item>
<item name="chat.general.information.suspension"><![CDATA[{lang}chat.suspension.{$suspension->type}{/lang} ({if $room}{$room}{else}{lang}chat.room.global{/lang}{/if})]]></item> <item name="chat.general.information.suspension"><![CDATA[{lang}chat.suspension.{$suspension->type}{/lang} ({if $room}{$room}{else}{lang}chat.room.global{/lang}{/if})]]></item>
<item name="chat.general.privateChannelTopic"><![CDATA[{literal}Sie befinden sich in einem privaten Kanal mit „{$username}“, um diesen zu schließen, klicken Sie einfach auf das Kreuz rechts.{/literal}]]></item>
<item name="chat.general.closePrivateChannel"><![CDATA[Privaten Kanal schließen]]></item>
<item name="chat.general.closeTopic"><![CDATA[Thema ausblenden]]></item>
</category> </category>
<category name="chat.header"> <category name="chat.header">

View File

@ -15,6 +15,9 @@
'chat.general.ban': '{lang}chat.general.ban{/lang}', 'chat.general.ban': '{lang}chat.general.ban{/lang}',
'chat.general.profile': '{lang}chat.general.profile{/lang}', 'chat.general.profile': '{lang}chat.general.profile{/lang}',
'chat.general.notify.title': '{lang}chat.general.notify.title{/lang}', 'chat.general.notify.title': '{lang}chat.general.notify.title{/lang}',
'chat.general.privateChannelTopic': '{lang}chat.general.privateChannelTopic{/lang}',
'chat.general.closePrivateChannel': '{lang}chat.general.closePrivateChannel{/lang}',
'chat.general.closeTopic': '{lang}chat.general.closeTopic{/lang}',
'chat.error.onMessageLoad': '{lang}chat.error.onMessageLoad{/lang}', 'chat.error.onMessageLoad': '{lang}chat.error.onMessageLoad{/lang}',
'chat.error.duplicateTab': '{lang}chat.error.duplicateTab{/lang}', 'chat.error.duplicateTab': '{lang}chat.error.duplicateTab{/lang}',
'chat.error.join': '{lang}chat.error.join{/lang}', 'chat.error.join': '{lang}chat.error.join{/lang}',
@ -71,7 +74,7 @@
{include file='header' sandbox=false sidebarOrientation='right'} {include file='header' sandbox=false sidebarOrientation='right'}
<div id="timsChatTopic" class="container{if $room->topic|language === ''} empty{/if}"> <div id="timsChatTopic" class="container{if $room->topic|language === ''} empty{/if}">
<span class="icon icon16 icon-remove jsTopicCloser"></span> <span class="icon icon16 icon-remove jsTopicCloser jsTooltip" title="{lang}chat.general.closeTopic{/lang}"></span>
<span class="topic">{$room->topic|language}</span> <span class="topic">{$room->topic|language}</span>
</div> </div>
@ -88,7 +91,7 @@
</ul> </ul>
</div> </div>
<div id="timsChatMessageContainer0" class="timsChatMessageContainer marginTop container active"> <div id="timsChatMessageContainer0" class="timsChatMessageContainer marginTop container active" data-user-id="0">
<p class="error noJsOnly" style="display: none;">{lang}chat.general.noJs{/lang}</p> <p class="error noJsOnly" style="display: none;">{lang}chat.general.noJs{/lang}</p>
<ul> <ul>
</ul> </ul>