Use view.$ shorthand for scoped jquery searches

Wish I'd noticed that one earlier. http://backbonejs.org/#View-dollar
This commit is contained in:
lilia 2015-03-27 18:47:58 -07:00
parent 0373252901
commit 5d4298697c
10 changed files with 48 additions and 46 deletions

View file

@ -22,15 +22,17 @@
extension.windows.getCurrent(function (windowInfo) {
var bg = extension.windows.getBackground();
window.$ = bg.$;
var body = $('body', document)
var conversation = bg.getConversationForWindow(windowInfo.id);
if (conversation) {
window.document.title = conversation.getTitle();
new bg.Whisper.ConversationView({
var view = new bg.Whisper.ConversationView({
model: conversation
}).$el.prependTo($('body', document));
$('input.send-message', document).focus();
});
view.$el.prependTo(body);
view.$('input.send-message').focus();
} else {
$('<div>').text('Error').prependTo($('body', document));
$('<div>').text('Error').prependTo(body);
}
});
}());