mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Simplify code a bit
This commit is contained in:
parent
a330127c0b
commit
3580ebfd5c
@ -727,40 +727,26 @@ Open private channel
|
||||
div.wrapInner '<ul>'
|
||||
$('#timsChatMessageContainer0').after div
|
||||
|
||||
channels = $ '#privateChannelsMenu li'
|
||||
channels.removeClass 'active'
|
||||
channels.each (key, channel) ->
|
||||
channel = $ channel;
|
||||
privateChannelID = channel.data 'privateChannelID'
|
||||
|
||||
if privateChannelID isnt 0
|
||||
channel.find('.userAvatar > *').replaceWith userList.allTime[privateChannelID].avatar[16]
|
||||
else
|
||||
channel.find('.icon').removeClass('icon32').addClass 'icon16'
|
||||
|
||||
$('.privateChannel').removeClass 'active'
|
||||
if userID isnt 0
|
||||
if $.wcfIsset "privateChannel#{userID}"
|
||||
$("#privateChannel#{userID} > .userAvatar > img").replaceWith userList.allTime[userID].avatar[32]
|
||||
else
|
||||
unless $.wcfIsset "privateChannel#{userID}"
|
||||
li = $ '<li>'
|
||||
li.attr 'id', "privateChannel#{userID}"
|
||||
li.data 'privateChannelID', userID
|
||||
li.addClass 'privateChannel'
|
||||
li.addClass 'active'
|
||||
li.append userList.allTime[userID].avatar[32]
|
||||
|
||||
span = $ '<span class="userAvatar framed" />'
|
||||
span.addClass 'jsTooltip'
|
||||
span.attr 'title', userList.allTime[userID].username
|
||||
|
||||
li.wrapInner span
|
||||
li.append $(userList.allTime[userID].avatar[16]).wrap(span).parent().addClass 'small'
|
||||
li.append $(userList.allTime[userID].avatar[32]).wrap(span).parent().addClass 'large'
|
||||
|
||||
$('#privateChannelsMenu ul').append li
|
||||
|
||||
do WCF.DOMNodeInsertedHandler.execute
|
||||
|
||||
$('#privateChannelsMenu').addClass 'shown'
|
||||
else
|
||||
$("#privateChannel0 > .userAvatar > .icon").removeClass('icon16').addClass 'icon32'
|
||||
|
||||
$('.timsChatMessageContainer').removeClass 'active'
|
||||
$("#timsChatMessageContainer#{userID}").addClass 'active'
|
||||
|
@ -102,16 +102,35 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
> .userAvatar.framed {
|
||||
> .userAvatar {
|
||||
&.large {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.small {
|
||||
display: block;
|
||||
}
|
||||
|
||||
&.framed {
|
||||
> .icon {
|
||||
background-color: @wcfContentBackgroundColor;
|
||||
border: 1px solid @wcfContainerBorderColor;
|
||||
padding: 1px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
> .userAvatar.framed {
|
||||
> .userAvatar {
|
||||
&.large {
|
||||
display: block;
|
||||
}
|
||||
|
||||
&.small {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.framed {
|
||||
> img, > canvas, > .icon {
|
||||
border-right-color: @wcfContentBackgroundColor;
|
||||
|
||||
@ -122,6 +141,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.timsChatMessageContainer {
|
||||
height: 320px;
|
||||
|
@ -77,7 +77,14 @@
|
||||
|
||||
<div id="privateChannelsMenu">
|
||||
<ul>
|
||||
<li id="privateChannel0" class="privateChannel active" data-private-channel-id="0"><span class="userAvatar framed jsTooltip" title="{lang}chat.general.room{/lang}"><span class="icon icon32 icon-comment-alt"></span></span></li>
|
||||
<li id="privateChannel0" class="privateChannel active" data-private-channel-id="0">
|
||||
<span class="userAvatar framed jsTooltip small" title="{lang}chat.general.room{/lang}">
|
||||
<span class="icon icon16 icon-comment-alt"></span>
|
||||
</span>
|
||||
<span class="userAvatar framed jsTooltip large" title="{lang}chat.general.room{/lang}">
|
||||
<span class="icon icon32 icon-comment-alt"></span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user