diff --git a/js/client-chat.js b/js/client-chat.js index 22bd698ba..38b0196ab 100644 --- a/js/client-chat.js +++ b/js/client-chat.js @@ -8,6 +8,7 @@ 'keypress textarea': 'keyPress', 'submit form': 'submit', 'click .username': 'clickUsername', + 'click .message-pm i': 'openPM', 'click': 'clickBackground' }, initialize: function() { @@ -79,13 +80,19 @@ var name = $(e.currentTarget).data('name'); app.addPopup('user', UserPopup, {name: name, sourceEl: e.currentTarget}); }, + openPM: function(e) { + e.preventDefault(); + e.stopPropagation(); + app.focusRoom(''); + app.rooms[''].focusPM($(e.currentTarget).data('name')); + }, clickBackground: function(e) { if (!e.shiftKey && !e.cmdKey && !e.ctrlKey) { if (window.getSelection && !window.getSelection().isCollapsed) { return; } app.dismissPopups(); - this.$chatbox.focus(); + if (this.$chatbox) this.$chatbox.focus(); } }, updateUser: function() { @@ -184,7 +191,7 @@ battletype = format + ' battle'; if (format === 'Random Battle') battletype = 'Random Battle'; } - this.$chat.append('
'); + this.$chat.append(''); break; case 'j': @@ -401,10 +408,12 @@ var highlight = isHighlighted ? ' style="background-color:#FDA;"' : ''; var chatDiv = '