conversation_panel.js 902 B

12345678910111213141516171819202122232425262728
  1. /*global $, Whisper, Backbone, textsecure, extension*/
  2. /*
  3. * vim: ts=4:sw=4:expandtab
  4. */
  5. (function () {
  6. 'use strict';
  7. window.Whisper = window.Whisper || {};
  8. extension.windows.getCurrent(function (windowInfo) {
  9. extension.windows.getBackground(function(bg) {
  10. window.$ = bg.$;
  11. var body = $('body', document);
  12. var conversation = bg.getConversationForWindow(windowInfo.id);
  13. if (conversation) {
  14. window.document.title = conversation.getTitle();
  15. var view = new bg.Whisper.ConversationView({
  16. model: conversation,
  17. appWindow: windowInfo
  18. });
  19. view.$el.prependTo(body);
  20. view.$('input.send-message').focus();
  21. } else {
  22. $('<div>').text('Error').prependTo(body);
  23. }
  24. });
  25. });
  26. }());