1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Made userlist toggleable.

This commit is contained in:
max-m 2011-12-04 11:52:56 +01:00
parent f47b796051
commit e7e8457ca5
2 changed files with 36 additions and 10 deletions

View File

@ -31,6 +31,11 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
this.changeRoom($(event.target)); this.changeRoom($(event.target));
} }
}, this)); }, this));
$('.chatUser .chatUserLink').click($.proxy(function (event) {
event.preventDefault();
this.toggleUserMenu($(event.target));
}, this));
}, },
changeRoom: function(target) { changeRoom: function(target) {
window.history.replaceState({}, '', target.attr('href')); window.history.replaceState({}, '', target.attr('href'));
@ -54,7 +59,7 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
if (data.topic == '') { if (data.topic == '') {
if(data.topic == '' && $('#topic').text().trim() == '') return; if(data.topic == '' && $('#topic').text().trim() == '') return;
$('#topic').wcfBlindOut('vertical', function() { $('#topic').wcfBlindOut('vertical', function() {
$('#topic').text(''); $(this).text('');
}); });
} else { } else {
if($('#topic').text().trim() != '') { if($('#topic').text().trim() != '') {
@ -87,6 +92,17 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
$('#loading-' + target.attr('id')).css({'marginTop' : function(index) {return (target.parent().height() / 2) - ($(this).height() / 2)}}); $('#loading-' + target.attr('id')).css({'marginTop' : function(index) {return (target.parent().height() / 2) - ($(this).height() / 2)}});
}, this) }, this)
}); });
},
toggleUserMenu: function(target) {
liUserID = '#' + target.parent().attr('id');
if($(liUserID).hasClass('activeMenuItem')) {
$(liUserID + ' .chatUserMenu').wcfBlindOut('vertical', function() {
$(liUserID).removeClass('activeMenuItem');
});
} else {
$(liUserID).addClass('activeMenuItem');
$(liUserID + ' .chatUserMenu').wcfBlindIn();
}
} }
}; };
})(jQuery, document); })(jQuery, document);

View File

@ -140,6 +140,20 @@
margin-left: 20px; margin-left: 20px;
} }
.chatUserMenu {
display: none;
}
#chatUserList .sidebarMenuGroup > ul li a {
margin-left: 20px;
}
/*
.chatUser.activeMenuItem {
margin-bottom: 5px;
}
*/
.ajaxLoad { .ajaxLoad {
margin-right: 2px; margin-right: 2px;
float: right; float: right;
@ -220,9 +234,10 @@
<h1 data-menu-item="timwolla.wcf.chat.userlist" class="menuHeader activeMenuItem">User</h1> <h1 data-menu-item="timwolla.wcf.chat.userlist" class="menuHeader activeMenuItem">User</h1>
<div class="sidebarMenuGroup"> <div class="sidebarMenuGroup">
<ul> <ul>
<li class="activeMenuItem"> {section name=user start=0 loop=10}
<a href="javascript:void(0)">User 1</a> <li id="user-{$user + 1}" class="chatUser">
<ul class="selectedUser"> <a class="chatUserLink" href="javascript:void(0)">User {$user + 1}</a>
<ul class="chatUserMenu">
<li> <li>
<a href="javascript:void(0)">Query</a> <a href="javascript:void(0)">Query</a>
<a href="javascript:void(0)">Kick</a> <a href="javascript:void(0)">Kick</a>
@ -231,12 +246,7 @@
</li> </li>
</ul> </ul>
</li> </li>
<li> {/section}
<a href="javascript:void(0)">User 2</a>
</li>
<li>
<a href="javascript:void(0)">User 3</a>
</li>
</ul> </ul>
</div> </div>
</div> </div>