From 6052aca7b2bcbcfd8dd2a4b689a780d118309c03 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Tue, 17 Sep 2013 11:22:42 -0700 Subject: [PATCH] Set focus correctly the other way. --- clientapp/app.js | 6 +++--- clientapp/models/contact.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clientapp/app.js b/clientapp/app.js index b4ce006..cd824f6 100644 --- a/clientapp/app.js +++ b/clientapp/app.js @@ -24,12 +24,12 @@ module.exports = { window.location = '/login'; } - app.hasFocus = false; + me.hasFocus = false; $(window).blur(function () { - app.hasFocus = false; + me.hasFocus = false; }); $(window).focus(function () { - app.hasFocus = true; + me.hasFocus = true; }); window.onbeforeunload = function () { if (client.sessionStarted) { diff --git a/clientapp/models/contact.js b/clientapp/models/contact.js index aa2f518..e33ed68 100644 --- a/clientapp/models/contact.js +++ b/clientapp/models/contact.js @@ -159,7 +159,7 @@ module.exports = HumanModel.define({ addMessage: function (message, notify) { message.owner = me.jid.bare; - if (notify && (!this.activeContact || (this.activeContact && !app.hasFocus)) && message.from.bare === this.jid) { + if (notify && (!this.activeContact || (this.activeContact && !me.hasFocus)) && message.from.bare === this.jid) { this.unreadCount++; app.notifier.show({ title: this.displayName,