diff --git a/js/client-chat.js b/js/client-chat.js index f039aeb37..d9dfdcfd4 100644 --- a/js/client-chat.js +++ b/js/client-chat.js @@ -81,8 +81,12 @@ clickUsername: function(e) { e.stopPropagation(); e.preventDefault(); + var position; + if (e.currentTarget.className === 'userbutton username') { + position = 'right'; + } var name = $(e.currentTarget).data('name'); - app.addPopup(UserPopup, {name: name, sourceEl: e.currentTarget}); + app.addPopup(UserPopup, {name: name, sourceEl: e.currentTarget, position: position}); }, clickLink: function(e) { if (e.cmdKey || e.metaKey || e.ctrlKey) return; @@ -805,13 +809,6 @@ if (!users.length) { buf += this.noNamedUsersOnline; } - if (this.room.userCount.unregistered) { - buf += '
  • '; - buf += 'Due to lag, ' + this.room.userCount.unregistered + ' unregistered users are hidden.'; - buf += ' '; - buf += '
    '; - buf += '
  • '; - } if (this.room.userCount.guests) { buf += '
  • (' + this.room.userCount.guests + ' guest' + (this.room.userCount.guests == 1 ? '' : 's') + ')
  • '; } diff --git a/js/client.js b/js/client.js index 88631a5fb..d6f0fe9b9 100644 --- a/js/client.js +++ b/js/client.js @@ -1353,6 +1353,8 @@ if (data && data.sourceEl) { this.sourceEl = data.sourceEl = $(data.sourceEl); } + if (data.type) this.type = data.type; + if (data.position) this.position = data.position; Backbone.View.apply(this, arguments); @@ -1369,25 +1371,41 @@ var room = $(window).height(); var height = $el.outerHeight(); + var width = $el.outerWidth(); var sourceHeight = this.sourceEl.outerHeight(); - if (room > offset.top + sourceHeight + height + 5 && - (offset.top + sourceHeight < room * 2/3 || offset.top + sourceHeight + 200 < room)) { - $el.css('top', offset.top + sourceHeight); - } else if (height + 5 <= offset.top) { - $el.css('bottom', room - offset.top); - } else if (height + 10 < room) { - $el.css('bottom', 5); + + if (this.position === 'right') { + + if (room > offset.top + height + 5 && + (offset.top < room * 2/3 || offset.top + 200 < room)) { + $el.css('top', offset.top); + } else { + $el.css('bottom', room - offset.top - sourceHeight); + } + $el.css('left', offset.left + this.sourceEl.outerWidth()); + } else { - $el.css('top', 0); + + if (room > offset.top + sourceHeight + height + 5 && + (offset.top + sourceHeight < room * 2/3 || offset.top + sourceHeight + 200 < room)) { + $el.css('top', offset.top + sourceHeight); + } else if (height + 5 <= offset.top) { + $el.css('bottom', room - offset.top); + } else if (height + 10 < room) { + $el.css('bottom', 5); + } else { + $el.css('top', 0); + } + + room = $(window).width() - offset.left; + if (room < width + 10) { + $el.css('right', 10); + } else { + $el.css('left', offset.left); + } + } - room = $(window).width() - offset.left; - var outerWidth = $el.outerWidth(); - if (room < outerWidth + 10) { - $el.css('right', 10); - } else { - $el.css('left', offset.left); - } $el.detach(); $measurer.remove(); }