mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Add user option to limit maximum amount of messages per tab
This commit is contained in:
parent
ea693dae00
commit
5d43af828b
@ -703,6 +703,13 @@ Insert the given messages into the chat stream.
|
|||||||
createNewMessage = yes
|
createNewMessage = yes
|
||||||
clearChannel 0
|
clearChannel 0
|
||||||
|
|
||||||
|
if message.isInPrivateChannel and message.sender is WCF.User.userID
|
||||||
|
container = $ "#timsChatMessageContainer#{message.receiver} > ul"
|
||||||
|
else if message.isInPrivateChannel
|
||||||
|
container = $ "#timsChatMessageContainer#{message.sender} > ul"
|
||||||
|
else
|
||||||
|
container = $ '#timsChatMessageContainer0 > ul'
|
||||||
|
|
||||||
if createNewMessage
|
if createNewMessage
|
||||||
message.isFollowUp = no
|
message.isFollowUp = no
|
||||||
output = v.messageTemplate.fetch
|
output = v.messageTemplate.fetch
|
||||||
@ -716,32 +723,35 @@ Insert the given messages into the chat stream.
|
|||||||
li.addClass 'ownMessage' if message.sender is WCF.User.userID
|
li.addClass 'ownMessage' if message.sender is WCF.User.userID
|
||||||
li.append output
|
li.append output
|
||||||
|
|
||||||
if message.isInPrivateChannel and message.sender is WCF.User.userID
|
li.appendTo container
|
||||||
li.appendTo $ "#timsChatMessageContainer#{message.receiver} > ul"
|
|
||||||
else if message.isInPrivateChannel
|
|
||||||
li.appendTo $ "#timsChatMessageContainer#{message.sender} > ul"
|
|
||||||
else
|
|
||||||
li.appendTo $ '#timsChatMessageContainer0 > ul'
|
|
||||||
else
|
else
|
||||||
message.isFollowUp = yes
|
message.isFollowUp = yes
|
||||||
output = v.messageTemplate.fetch
|
output = v.messageTemplate.fetch
|
||||||
message: message
|
message: message
|
||||||
messageTypes: v.config.messageTypes
|
messageTypes: v.config.messageTypes
|
||||||
|
|
||||||
if message.isInPrivateChannel and message.sender is WCF.User.userID
|
textContainer = container.find '.timsChatMessage:last-child .timsChatTextContainer'
|
||||||
messageContainerID = message.receiver
|
|
||||||
else if message.isInPrivateChannel
|
|
||||||
messageContainerID = message.sender
|
|
||||||
else
|
|
||||||
messageContainerID = 0
|
|
||||||
|
|
||||||
textContainer = $("#timsChatMessageContainer#{messageContainerID}").find '.timsChatMessage:last-child .timsChatTextContainer'
|
|
||||||
textContainer.append $(output).find('.timsChatTextContainer li:last-child')
|
textContainer.append $(output).find('.timsChatTextContainer li:last-child')
|
||||||
|
|
||||||
# unmark messages
|
# unmark messages
|
||||||
textContainer.parents('.timsChatMessage').removeClass 'checked'
|
textContainer.parents('.timsChatMessage').removeClass 'checked'
|
||||||
textContainer.siblings('.timsChatMessageGroupMarker').prop 'checked', false
|
textContainer.siblings('.timsChatMessageGroupMarker').prop 'checked', false
|
||||||
|
|
||||||
|
if v.config.messagesPerTab
|
||||||
|
timsChatText = container.find '.timsChatText'
|
||||||
|
|
||||||
|
if timsChatText.length > v.config.messagesPerTab
|
||||||
|
firstMessage = do timsChatText.first
|
||||||
|
timsChatMessage = firstMessage.parents '.timsChatMessage'
|
||||||
|
|
||||||
|
if timsChatMessage.find('.timsChatTextContainer').children().length > 1
|
||||||
|
time = firstMessage.siblings(':first').find '> time'
|
||||||
|
timsChatMessage.find('.timsChatInnerMessage > time').replaceWith time
|
||||||
|
|
||||||
|
do firstMessage.remove
|
||||||
|
else
|
||||||
|
do timsChatMessage.remove
|
||||||
|
|
||||||
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
|
||||||
|
@ -125,6 +125,11 @@
|
|||||||
<item name="wcf.user.activityPoint.objectType.be.bastelstu.chat.activityPointEvent.message"><![CDATA[Chat-Nachrichten]]></item>
|
<item name="wcf.user.activityPoint.objectType.be.bastelstu.chat.activityPointEvent.message"><![CDATA[Chat-Nachrichten]]></item>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
|
<category name="wcf.user.option">
|
||||||
|
<item name="wcf.user.option.chatMessagesPerTab"><![CDATA[Chat-Nachrichten]]></item>
|
||||||
|
<item name="wcf.user.option.chatMessagesPerTab.description"><![CDATA[Anzahl der Chat-Nachrichten, die pro Tab angezeigt werden. [0 für unbeschränkt]]]></item>
|
||||||
|
</category>
|
||||||
|
|
||||||
<category name="chat.error">
|
<category name="chat.error">
|
||||||
<item name="chat.error.notFound"><![CDATA[Der Befehl „{$exception->getCommand()}“ wurde nicht gefunden.]]></item>
|
<item name="chat.error.notFound"><![CDATA[Der Befehl „{$exception->getCommand()}“ wurde nicht gefunden.]]></item>
|
||||||
<item name="chat.error.userNotFound"><![CDATA[Der Benutzer „{$exception->getUsername()}“ wurde nicht gefunden.]]></item>
|
<item name="chat.error.userNotFound"><![CDATA[Der Benutzer „{$exception->getUsername()}“ wurde nicht gefunden.]]></item>
|
||||||
|
@ -125,6 +125,11 @@
|
|||||||
<item name="wcf.user.activityPoint.objectType.be.bastelstu.chat.activityPointEvent.message"><![CDATA[Chat Messages]]></item>
|
<item name="wcf.user.activityPoint.objectType.be.bastelstu.chat.activityPointEvent.message"><![CDATA[Chat Messages]]></item>
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
|
<category name="wcf.user.option">
|
||||||
|
<item name="wcf.user.option.chatMessagesPerTab"><![CDATA[Chat Messages]]></item>
|
||||||
|
<item name="wcf.user.option.chatMessagesPerTab.description"><![CDATA[Amount of messages per tab being displayed at once. [0 for infinite]]]></item>
|
||||||
|
</category>
|
||||||
|
|
||||||
<category name="chat.error">
|
<category name="chat.error">
|
||||||
<item name="chat.error.notFound"><![CDATA[The command “{$exception->getCommand()}” could not be found.]]></item>
|
<item name="chat.error.notFound"><![CDATA[The command “{$exception->getCommand()}” could not be found.]]></item>
|
||||||
<item name="chat.error.userNotFound"><![CDATA[The user “{$exception->getUsername()}” could not be found.]]></item>
|
<item name="chat.error.userNotFound"><![CDATA[The user “{$exception->getUsername()}” could not be found.]]></item>
|
||||||
|
@ -58,7 +58,8 @@
|
|||||||
messageURL: '{link application="chat" controller="NewMessages"}{/link}',
|
messageURL: '{link application="chat" controller="NewMessages"}{/link}',
|
||||||
installedCommands: [ {implode from=$commands item='command'}'{$command|encodeJS}'{/implode} ],
|
installedCommands: [ {implode from=$commands item='command'}'{$command|encodeJS}'{/implode} ],
|
||||||
messageTypes: { {implode from=$messageTypes key='name' item='messageType'}'{$name|substr:5|encodeJS}': {$messageType}{/implode} },
|
messageTypes: { {implode from=$messageTypes key='name' item='messageType'}'{$name|substr:5|encodeJS}': {$messageType}{/implode} },
|
||||||
autoAwayTime: {@CHAT_AUTOAWAY}
|
autoAwayTime: {@CHAT_AUTOAWAY},
|
||||||
|
messagesPerTab: {@$__wcf->getUser()->chatMessagesPerTab}
|
||||||
};
|
};
|
||||||
|
|
||||||
{event name='beforeInit'}
|
{event name='beforeInit'}
|
||||||
|
@ -19,6 +19,15 @@
|
|||||||
<optiontype>boolean</optiontype>
|
<optiontype>boolean</optiontype>
|
||||||
<defaultvalue>1</defaultvalue>
|
<defaultvalue>1</defaultvalue>
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
|
<option name="chatMessagesPerTab">
|
||||||
|
<categoryname>settings.general.interface</categoryname>
|
||||||
|
<optiontype>integer</optiontype>
|
||||||
|
<visible>1</visible>
|
||||||
|
<editable>1</editable>
|
||||||
|
<defaultvalue>0</defaultvalue>
|
||||||
|
<minvalue>0</minvalue>
|
||||||
|
</option>
|
||||||
</options>
|
</options>
|
||||||
</import>
|
</import>
|
||||||
</data>
|
</data>
|
Loading…
Reference in New Issue
Block a user