mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-21 21:30:08 +00:00
Fix marking of messages in speech bubbles
It failed on appending a new message to the same speech bubble
This commit is contained in:
parent
4091a6e7e6
commit
6f9418e167
@ -381,15 +381,17 @@ Visibly mark the message once the associated checkbox is checked.
|
|||||||
|
|
||||||
if checked
|
if checked
|
||||||
elem.parents('.timsChatMessage').addClass 'checked'
|
elem.parents('.timsChatMessage').addClass 'checked'
|
||||||
elem.parents('.timsChatTextContainer').siblings('.timsChatMessageBlockMarker').prop 'checked', true
|
elem.parents('.timsChatTextContainer').siblings('.timsChatMessageGroupMarker').prop 'checked', true
|
||||||
else
|
else
|
||||||
delete markedMessages[messageID]
|
delete markedMessages[messageID]
|
||||||
|
|
||||||
parent.removeClass 'checked'
|
parent.removeClass 'checked'
|
||||||
elem.parents('.timsChatMessage').removeClass 'checked'
|
elem.parents('.timsChatMessage').removeClass 'checked'
|
||||||
elem.parents('.timsChatTextContainer').siblings('.timsChatMessageBlockMarker').prop 'checked', false
|
elem.parents('.timsChatTextContainer').siblings('.timsChatMessageGroupMarker').prop 'checked', false
|
||||||
|
|
||||||
$(document).on 'click', '.timsChatMessageBlockMarker', (event) ->
|
# This function can be used to toggle the marking state of every “submessage” of one message container (speech bubble)
|
||||||
|
# The according element with the class “.timsChatMessageGroupMarker” has to be made visible via CSS.
|
||||||
|
$(document).on 'click', '.timsChatMessageGroupMarker', (event) ->
|
||||||
$(event.target).siblings('.timsChatTextContainer').children('li').each (key, value) ->
|
$(event.target).siblings('.timsChatTextContainer').children('li').each (key, value) ->
|
||||||
elem = $(value).find '.timsChatMessageMarker'
|
elem = $(value).find '.timsChatMessageMarker'
|
||||||
|
|
||||||
@ -617,17 +619,17 @@ Insert the given messages into the chat stream.
|
|||||||
if $('.timsChatMessage:last-child .timsChatTextContainer').is('ul') and lastMessage isnt null and lastMessage.type in [ v.config.messageTypes.NORMAL, v.config.messageTypes.WHISPER ]
|
if $('.timsChatMessage:last-child .timsChatTextContainer').is('ul') and lastMessage isnt null and lastMessage.type in [ v.config.messageTypes.NORMAL, v.config.messageTypes.WHISPER ]
|
||||||
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
|
||||||
createNewMessage = no
|
createNewMessage = no
|
||||||
|
|
||||||
if message.type is v.config.messageTypes.CLEAR
|
if message.type is v.config.messageTypes.CLEAR
|
||||||
createNewMessage = yes
|
createNewMessage = yes
|
||||||
clearChannel 0
|
clearChannel 0
|
||||||
|
|
||||||
if createNewMessage
|
if createNewMessage
|
||||||
message.isFollowUp = no
|
message.isFollowUp = no
|
||||||
output = v.messageTemplate.fetch
|
output = v.messageTemplate.fetch
|
||||||
message: message
|
message: message
|
||||||
messageTypes: v.config.messageTypes
|
messageTypes: v.config.messageTypes
|
||||||
|
|
||||||
li = $ '<li></li>'
|
li = $ '<li></li>'
|
||||||
li.addClass 'timsChatMessage'
|
li.addClass 'timsChatMessage'
|
||||||
li.addClass "timsChatMessage#{message.type}"
|
li.addClass "timsChatMessage#{message.type}"
|
||||||
@ -653,11 +655,16 @@ Insert the given messages into the chat stream.
|
|||||||
messageContainerID = message.sender
|
messageContainerID = message.sender
|
||||||
else
|
else
|
||||||
messageContainerID = 0
|
messageContainerID = 0
|
||||||
|
|
||||||
$("#timsChatMessageContainer#{messageContainerID} .timsChatMessage:last-child .timsChatTextContainer").append $(output).find('.timsChatTextContainer li:last-child')
|
textContainer = $("#timsChatMessageContainer#{messageContainerID}").find '.timsChatMessage:last-child .timsChatTextContainer'
|
||||||
|
textContainer.append $(output).find('.timsChatTextContainer li:last-child')
|
||||||
|
|
||||||
|
# unmark messages
|
||||||
|
textContainer.parents('.timsChatMessage').removeClass 'checked'
|
||||||
|
textContainer.siblings('.timsChatMessageGroupMarker').prop 'checked', false
|
||||||
|
|
||||||
lastMessage = message
|
lastMessage = message
|
||||||
|
|
||||||
$('.timsChatMessageContainer.active').scrollTop $('.timsChatMessageContainer.active').prop('scrollHeight') if $('#timsChatAutoscroll').data('status') is 1
|
$('.timsChatMessageContainer.active').scrollTop $('.timsChatMessageContainer.active').prop('scrollHeight') if $('#timsChatAutoscroll').data('status') is 1
|
||||||
|
|
||||||
Handles scroll event of message containers
|
Handles scroll event of message containers
|
||||||
|
@ -296,7 +296,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.timsChatMessageMarker, .timsChatMessageBlockMarker {
|
.timsChatMessageMarker, .timsChatMessageGroupMarker {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,22 +356,22 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timsChatMessageBlockMarker {
|
.timsChatMessageGroupMarker {
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.timsChatMessageMarker, .timsChatMessageBlockMarker {
|
.timsChatMessageMarker, .timsChatMessageGroupMarker {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: -@wcfGapLarge ;
|
right: -@wcfGapLarge ;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.bubble {
|
&.bubble {
|
||||||
.timsChatMessageMarker, .timsChatMessageBlockMarker {
|
.timsChatMessageMarker, .timsChatMessageGroupMarker {
|
||||||
right: -@wcfGapLarge - 1;
|
right: -@wcfGapLarge - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.right {
|
&.right {
|
||||||
.timsChatMessageMarker, .timsChatMessageBlockMarker {
|
.timsChatMessageMarker, .timsChatMessageGroupMarker {
|
||||||
// maybe find a better way, will do it for now
|
// maybe find a better way, will do it for now
|
||||||
right: -@wcfGapLarge - @wcfGapMedium - 32 - 1;
|
right: -@wcfGapLarge - @wcfGapMedium - 32 - 1;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<input type="checkbox" class="timsChatMessageBlockMarker jsTooltip" value="{@$message.messageID}" title="{lang}chat.global.markAll{/lang}" />
|
<input type="checkbox" class="timsChatMessageGroupMarker jsTooltip" value="{@$message.messageID}" title="{lang}chat.global.markAll{/lang}" />
|
||||||
{elseif $message.type == $messageTypes.INFORMATION}
|
{elseif $message.type == $messageTypes.INFORMATION}
|
||||||
<div class="timsChatTextContainer">
|
<div class="timsChatTextContainer">
|
||||||
<span class="timsChatText" data-message-id="{@$message.messageID}">
|
<span class="timsChatText" data-message-id="{@$message.messageID}">
|
||||||
|
Loading…
Reference in New Issue
Block a user