1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40: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:
Maximilian Mader 2014-06-21 18:54:04 +02:00
parent 4091a6e7e6
commit 6f9418e167
3 changed files with 23 additions and 16 deletions

View File

@ -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'
@ -654,7 +656,12 @@ Insert the given messages into the chat stream.
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

View File

@ -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;
} }

View File

@ -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}">