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>'
|
div.wrapInner '<ul>'
|
||||||
$('#timsChatMessageContainer0').after div
|
$('#timsChatMessageContainer0').after div
|
||||||
|
|
||||||
channels = $ '#privateChannelsMenu li'
|
$('.privateChannel').removeClass 'active'
|
||||||
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'
|
|
||||||
|
|
||||||
if userID isnt 0
|
if userID isnt 0
|
||||||
if $.wcfIsset "privateChannel#{userID}"
|
unless $.wcfIsset "privateChannel#{userID}"
|
||||||
$("#privateChannel#{userID} > .userAvatar > img").replaceWith userList.allTime[userID].avatar[32]
|
|
||||||
else
|
|
||||||
li = $ '<li>'
|
li = $ '<li>'
|
||||||
li.attr 'id', "privateChannel#{userID}"
|
li.attr 'id', "privateChannel#{userID}"
|
||||||
li.data 'privateChannelID', userID
|
li.data 'privateChannelID', userID
|
||||||
li.addClass 'privateChannel'
|
li.addClass 'privateChannel'
|
||||||
li.addClass 'active'
|
|
||||||
li.append userList.allTime[userID].avatar[32]
|
|
||||||
|
|
||||||
span = $ '<span class="userAvatar framed" />'
|
span = $ '<span class="userAvatar framed" />'
|
||||||
span.addClass 'jsTooltip'
|
span.addClass 'jsTooltip'
|
||||||
span.attr 'title', userList.allTime[userID].username
|
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
|
$('#privateChannelsMenu ul').append li
|
||||||
|
|
||||||
do WCF.DOMNodeInsertedHandler.execute
|
do WCF.DOMNodeInsertedHandler.execute
|
||||||
|
|
||||||
$('#privateChannelsMenu').addClass 'shown'
|
$('#privateChannelsMenu').addClass 'shown'
|
||||||
else
|
|
||||||
$("#privateChannel0 > .userAvatar > .icon").removeClass('icon16').addClass 'icon32'
|
|
||||||
|
|
||||||
$('.timsChatMessageContainer').removeClass 'active'
|
$('.timsChatMessageContainer').removeClass 'active'
|
||||||
$("#timsChatMessageContainer#{userID}").addClass 'active'
|
$("#timsChatMessageContainer#{userID}").addClass 'active'
|
||||||
|
@ -102,20 +102,40 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
> .userAvatar.framed {
|
> .userAvatar {
|
||||||
> .icon {
|
&.large {
|
||||||
background-color: @wcfContentBackgroundColor;
|
display: none;
|
||||||
border: 1px solid @wcfContainerBorderColor;
|
}
|
||||||
padding: 1px;
|
|
||||||
|
&.small {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.framed {
|
||||||
|
> .icon {
|
||||||
|
background-color: @wcfContentBackgroundColor;
|
||||||
|
border: 1px solid @wcfContainerBorderColor;
|
||||||
|
padding: 1px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
> .userAvatar.framed {
|
> .userAvatar {
|
||||||
> img, > canvas, > .icon {
|
&.large {
|
||||||
border-right-color: @wcfContentBackgroundColor;
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
border-radius: @wcfContainerBorderRadius 0 0 @wcfContainerBorderRadius;
|
&.small {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.framed {
|
||||||
|
> img, > canvas, > .icon {
|
||||||
|
border-right-color: @wcfContentBackgroundColor;
|
||||||
|
|
||||||
|
border-radius: @wcfContainerBorderRadius 0 0 @wcfContainerBorderRadius;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,14 @@
|
|||||||
|
|
||||||
<div id="privateChannelsMenu">
|
<div id="privateChannelsMenu">
|
||||||
<ul>
|
<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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user