2014-11-09 11:17:26 +01:00
|
|
|
/*global $, Whisper, Backbone, textsecure, extension*/
|
2015-09-07 23:53:43 +02:00
|
|
|
/*
|
|
|
|
* vim: ts=4:sw=4:expandtab
|
2014-05-04 08:34:13 +02:00
|
|
|
*/
|
2014-11-09 11:17:26 +01:00
|
|
|
(function () {
|
2015-09-01 22:04:20 +02:00
|
|
|
'use strict';
|
2014-05-04 08:34:13 +02:00
|
|
|
|
2015-12-07 22:42:19 +01:00
|
|
|
function logError(error) {
|
|
|
|
extension.windows.getBackground(function(bg) {
|
|
|
|
bg.console.log('index.html: ', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
window.onerror = function(message, script, line, col, error) {
|
|
|
|
logError(error);
|
|
|
|
};
|
|
|
|
|
2015-09-01 22:04:20 +02:00
|
|
|
var view;
|
2015-05-11 23:22:15 +02:00
|
|
|
|
2015-09-01 22:04:20 +02:00
|
|
|
function render() {
|
|
|
|
extension.windows.getBackground(function(bg) {
|
2015-05-21 22:05:52 +02:00
|
|
|
extension.windows.getCurrent(function(appWindow) {
|
2015-12-07 22:42:19 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2015-05-21 22:05:52 +02:00
|
|
|
});
|
2015-09-01 22:04:20 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
window.addEventListener('onreload', render);
|
|
|
|
render();
|
2014-11-09 11:17:26 +01:00
|
|
|
}());
|