From: Darren Date: Wed, 4 Jun 2014 18:09:52 +0000 (+0100) Subject: usermenu:created plugin interface X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=073df5194cfa418f9080a8023948d93e5dedc035;p=KiwiIRC.git usermenu:created plugin interface --- diff --git a/client/src/views/memberlist.js b/client/src/views/memberlist.js index 22721b0..a582087 100644 --- a/client/src/views/memberlist.js +++ b/client/src/views/memberlist.js @@ -50,10 +50,11 @@ _kiwi.view.MemberList = Backbone.View.extend({ var menu = new _kiwi.view.MenuBox(member.get('nick') || 'User'); menu.addItem('userbox', userbox.$el); menu.showFooter(false); - menu.show(); - // Position the userbox + menubox - (function() { + _kiwi.global.events.emit('usermenu:created', {menu: menu, userbox: userbox}) + .done(_.bind(function() { + menu.show(); + var t = event.pageY, m_bottom = t + menu.$el.outerHeight(), // Where the bottom of menu will be memberlist_bottom = this.$el.parent().offset().top + this.$el.parent().outerHeight(), @@ -81,7 +82,15 @@ _kiwi.view.MemberList = Backbone.View.extend({ left: l, top: t }); - }).call(this); + + }, this)) + .prevented(_.bind(function() { + userbox = null; + + menu.dispose(); + menu = null; + }, this)); + },