diff --git a/js/index.js b/js/index.js index 95dca20b..621abe2a 100644 --- a/js/index.js +++ b/js/index.js @@ -19,23 +19,21 @@ function render() { extension.windows.getBackground(function(bg) { - extension.windows.getCurrent(function(appWindow) { - bg.ConversationController.updateInbox().then(function() { - try { - if (view) { view.remove(); } - var $body = bg.$('body',document).empty(); - view = new bg.Whisper.InboxView({appWindow: appWindow}); - view.$el.prependTo($body); - window.openConversation = function(conversation) { - if (conversation) { - view.openConversation(null, conversation); - } - }; - openConversation(bg.getOpenConversation()); - } catch (e) { - logError(e); - } - }); + bg.ConversationController.updateInbox().then(function() { + try { + if (view) { view.remove(); } + var $body = bg.$('body',document).empty(); + view = new bg.Whisper.InboxView({window: window}); + view.$el.prependTo($body); + window.openConversation = function(conversation) { + if (conversation) { + view.openConversation(null, conversation); + } + }; + openConversation(bg.getOpenConversation()); + } catch (e) { + logError(e); + } }); }); } diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 3a61b147..383702d7 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -87,15 +87,15 @@ emoji_util.parse(this.$('.conversation-name')); - this.appWindow = options.appWindow; + this.window = options.window; this.fileInput = new Whisper.FileInputView({ el: this.$('form.send'), - window: this.appWindow.contentWindow + window: this.window }); this.view = new Whisper.MessageListView({ collection: this.model.messageCollection, - window: this.appWindow.contentWindow + window: this.window }); this.$('.discussion-container').append(this.view.el); this.view.render(); @@ -103,18 +103,18 @@ this.$messageField = this.$('.send-message'); var onResize = this.forceUpdateMessageFieldSize.bind(this); - this.appWindow.contentWindow.addEventListener('resize', onResize); + this.window.addEventListener('resize', onResize); var onFocus = function() { if (this.$el.css('display') !== 'none') { this.markRead(); } }.bind(this); - this.appWindow.contentWindow.addEventListener('focus', onFocus); + this.window.addEventListener('focus', onFocus); extension.windows.onClosed(function () { - this.appWindow.contentWindow.removeEventListener('resize', onResize); - this.appWindow.contentWindow.removeEventListener('focus', onFocus); + this.window.removeEventListener('resize', onResize); + this.window.removeEventListener('focus', onFocus); window.autosize.destroy(this.$messageField); this.remove(); this.model.messageCollection.reset([]); @@ -313,7 +313,7 @@ newGroupUpdate: function() { this.newGroupUpdateView = new Whisper.NewGroupUpdateView({ model: this.model, - window: this.appWindow.contentWindow + window: this.window }); this.listenBack(this.newGroupUpdateView); }, diff --git a/js/views/inbox_view.js b/js/views/inbox_view.js index 2e6771dd..90ee5970 100644 --- a/js/views/inbox_view.js +++ b/js/views/inbox_view.js @@ -49,7 +49,7 @@ if ($el === null || $el.length === 0) { var view = new Whisper.ConversationView({ model: conversation, - appWindow: this.model.appWindow + window: this.model.window }); $el = view.$el; } @@ -107,7 +107,7 @@ new Whisper.FontSizeView({ el: this.$el }); this.conversation_stack = new Whisper.ConversationStack({ el: this.$('.conversation-stack'), - model: { appWindow: options.appWindow } + model: { window: options.window } }); var inboxCollection = getInboxCollection();