There is no in-window navigation in the chrome app environment, so nix the first if-clause here. Also make it programmatically reloadable and fix indentation. // FREEBIE
		
			
				
	
	
		
			29 lines
		
	
	
	
		
			880 B
			
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
	
		
			880 B
			
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/*global $, Whisper, Backbone, textsecure, extension*/
 | 
						|
/*
 | 
						|
 * vim: ts=4:sw=4:expandtab
 | 
						|
 */
 | 
						|
(function () {
 | 
						|
    'use strict';
 | 
						|
 | 
						|
    var view;
 | 
						|
 | 
						|
    function render() {
 | 
						|
        extension.windows.getBackground(function(bg) {
 | 
						|
            extension.windows.getCurrent(function(appWindow) {
 | 
						|
                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());
 | 
						|
            });
 | 
						|
        });
 | 
						|
    }
 | 
						|
 | 
						|
    window.addEventListener('onreload', render);
 | 
						|
    render();
 | 
						|
}());
 |