From e1040e6529c2fa917724be5fcd50aa7d751e26f0 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Tue, 30 Apr 2013 13:37:57 -0700 Subject: [PATCH] Highlight active PM --- js/client-mainmenu.js | 12 ++++++++++-- style/client.css | 12 +++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/js/client-mainmenu.js b/js/client-mainmenu.js index d26f2da4c..6146d3b57 100644 --- a/js/client-mainmenu.js +++ b/js/client-mainmenu.js @@ -8,7 +8,9 @@ 'keydown textarea': 'keyPress', 'click .username': 'clickUsername', 'click .closebutton': 'closePM', - 'click .pm-window': 'clickPMBackground' + 'click .pm-window': 'clickPMBackground', + 'focus textarea': 'onFocusPM', + 'blur textarea': 'onBlurPM' }, initialize: function() { // left menu @@ -78,7 +80,13 @@ this.$pmBox.find('.pm-window-'+userid).hide(); }, focusPM: function(name) { - this.openPM(name).find('textarea[name=message]').focus(); + this.openPM(name).prependTo(this.$pmBox).find('textarea[name=message]').focus(); + }, + onFocusPM: function(e) { + $(e.currentTarget).closest('.pm-window').addClass('focused'); + }, + onBlurPM: function(e) { + $(e.currentTarget).closest('.pm-window').removeClass('focused'); }, keyPress: function(e) { if (e.keyCode === 13 && !e.shiftKey) { // Enter diff --git a/style/client.css b/style/client.css index 796611057..130459e20 100644 --- a/style/client.css +++ b/style/client.css @@ -289,7 +289,7 @@ body { margin-bottom: 12px; } .pm-window h3 { - background: #f8f8f8; + background: rgba(248,248,248,.8); color: #777777; margin: 0; padding: 2px 5px; @@ -297,6 +297,7 @@ body { border: 1px solid #AAAAAA; border-top-left-radius: 5px; border-top-right-radius: 5px; + cursor: default; } .pm-window h3 .closebutton { float: right; @@ -325,6 +326,15 @@ body { .pm-window.collapsed .pm-log-add { display: none; } +.pm-window.focused h3, +.pm-window.focused .pm-log, +.pm-window.focused .pm-log.add { + border-color: #555555; +} +.pm-window.focused h3 { + background: #f8f8f8; + color: #222222; +} .tiny-layout .leftmenu, .tiny-layout .rightmenu,