From 2ee34343a846e22b612c6ec4ed6bfade8c81e539 Mon Sep 17 00:00:00 2001 From: lilia Date: Thu, 5 Mar 2015 15:44:53 -0800 Subject: [PATCH] Use consistent boiler plate throughout js files --- js/models/conversations.js | 1 - js/models/messages.js | 1 - js/views/attachment_preview_view.js | 4 ++-- js/views/conversation_list_item_view.js | 4 +--- js/views/conversation_list_view.js | 31 +++++++++++-------------- js/views/file_input_view.js | 3 +-- js/views/key_verification_view.js | 1 - js/views/list_view.js | 3 +-- js/views/message_detail_view.js | 1 - js/views/message_list_view.js | 3 +-- js/views/message_view.js | 1 - js/views/new_conversation_view.js | 3 +-- js/views/new_group_update_view.js | 1 - js/views/phone-input-view.js | 4 ++-- js/views/toast_view.js | 4 ++-- 15 files changed, 25 insertions(+), 40 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index a7f08441d..b21af2018 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -15,7 +15,6 @@ */ (function () { 'use strict'; - window.Whisper = window.Whisper || {}; // TODO: Factor out private and group subclasses of Conversation diff --git a/js/models/messages.js b/js/models/messages.js index 9f972235a..40445e322 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -15,7 +15,6 @@ */ (function () { 'use strict'; - window.Whisper = window.Whisper || {}; var Message = Backbone.Model.extend({ diff --git a/js/views/attachment_preview_view.js b/js/views/attachment_preview_view.js index 21511d427..ce72f1b1b 100644 --- a/js/views/attachment_preview_view.js +++ b/js/views/attachment_preview_view.js @@ -13,10 +13,10 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -var Whisper = Whisper || {}; - (function () { 'use strict'; + window.Whisper = window.Whisper || {}; + Whisper.AttachmentPreviewView = Whisper.View.extend({ className: 'attachment-preview', template: $('#attachment-preview').html(), diff --git a/js/views/conversation_list_item_view.js b/js/views/conversation_list_item_view.js index a2bd735d4..7b9bba724 100644 --- a/js/views/conversation_list_item_view.js +++ b/js/views/conversation_list_item_view.js @@ -13,11 +13,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ - - (function () { 'use strict'; - var Whisper = Whisper || {}; + window.Whisper = window.Whisper || {}; // list of conversations, showing user/group and last message sent Whisper.ConversationListItemView = Whisper.View.extend({ diff --git a/js/views/conversation_list_view.js b/js/views/conversation_list_view.js index 5fb396988..4dd7adebc 100644 --- a/js/views/conversation_list_view.js +++ b/js/views/conversation_list_view.js @@ -13,23 +13,20 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -var Whisper = Whisper || {}; - (function () { - 'use strict'; + 'use strict'; + window.Whisper = window.Whisper || {}; - Whisper.ConversationListView = Whisper.ListView.extend({ - tagName: 'div', - itemView: Whisper.ConversationListItemView, - - events: { - 'click .contact': 'select', - }, - - select: function(e) { - var target = $(e.target).closest('.contact'); - target.siblings().removeClass('selected'); - return false; - }, - }); + Whisper.ConversationListView = Whisper.ListView.extend({ + tagName: 'div', + itemView: Whisper.ConversationListItemView, + events: { + 'click .contact': 'select', + }, + select: function(e) { + var target = $(e.target).closest('.contact'); + target.siblings().removeClass('selected'); + return false; + } + }); })(); diff --git a/js/views/file_input_view.js b/js/views/file_input_view.js index a1fbc2d52..f65a9faf8 100644 --- a/js/views/file_input_view.js +++ b/js/views/file_input_view.js @@ -13,10 +13,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -var Whisper = Whisper || {}; - (function () { 'use strict'; + window.Whisper = window.Whisper || {}; Whisper.FileSizeToast = Whisper.ToastView.extend({ template: $('#file-size-modal').html() diff --git a/js/views/key_verification_view.js b/js/views/key_verification_view.js index fd98a7df2..66971ef94 100644 --- a/js/views/key_verification_view.js +++ b/js/views/key_verification_view.js @@ -15,7 +15,6 @@ */ (function () { 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.KeyVerificationView = Whisper.View.extend({ diff --git a/js/views/list_view.js b/js/views/list_view.js index f6cb43168..31e4d76e6 100644 --- a/js/views/list_view.js +++ b/js/views/list_view.js @@ -13,10 +13,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -var Whisper = Whisper || {}; - (function () { 'use strict'; + window.Whisper = window.Whisper || {}; /* * Generic list view that watches a given collection, wraps its members in diff --git a/js/views/message_detail_view.js b/js/views/message_detail_view.js index 457c5f632..a86c28b42 100644 --- a/js/views/message_detail_view.js +++ b/js/views/message_detail_view.js @@ -15,7 +15,6 @@ */ (function () { 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.MessageDetailView = Whisper.View.extend({ diff --git a/js/views/message_list_view.js b/js/views/message_list_view.js index 9b18dc362..207814bea 100644 --- a/js/views/message_list_view.js +++ b/js/views/message_list_view.js @@ -13,10 +13,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -var Whisper = Whisper || {}; - (function () { 'use strict'; + window.Whisper = window.Whisper || {}; Whisper.MessageListView = Whisper.ListView.extend({ tagName: 'ul', diff --git a/js/views/message_view.js b/js/views/message_view.js index 95bd0d0dc..2ba3d33e3 100644 --- a/js/views/message_view.js +++ b/js/views/message_view.js @@ -15,7 +15,6 @@ */ (function () { 'use strict'; - window.Whisper = window.Whisper || {}; var ErrorView = Backbone.View.extend({ diff --git a/js/views/new_conversation_view.js b/js/views/new_conversation_view.js index fb61d806c..059b3084e 100644 --- a/js/views/new_conversation_view.js +++ b/js/views/new_conversation_view.js @@ -13,10 +13,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ - (function () { 'use strict'; - var Whisper = Whisper || {}; + window.Whisper = window.Whisper || {}; var ContactsTypeahead = Backbone.TypeaheadCollection.extend({ typeaheadAttributes: [ diff --git a/js/views/new_group_update_view.js b/js/views/new_group_update_view.js index 2440c631b..6b365c783 100644 --- a/js/views/new_group_update_view.js +++ b/js/views/new_group_update_view.js @@ -15,7 +15,6 @@ */ (function () { 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.NewGroupUpdateView = Whisper.View.extend({ diff --git a/js/views/phone-input-view.js b/js/views/phone-input-view.js index f3fa4c7c5..96cf1ebd3 100644 --- a/js/views/phone-input-view.js +++ b/js/views/phone-input-view.js @@ -13,10 +13,10 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -var Whisper = Whisper || {}; - (function () { 'use strict'; + window.Whisper = window.Whisper || {}; + Whisper.PhoneInputView = Whisper.View.extend({ tagName: 'div', className: 'phone-input', diff --git a/js/views/toast_view.js b/js/views/toast_view.js index eb2098824..8d967d69f 100644 --- a/js/views/toast_view.js +++ b/js/views/toast_view.js @@ -13,10 +13,10 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ -var Whisper = Whisper || {}; - (function () { 'use strict'; + window.Whisper = window.Whisper || {}; + Whisper.ToastView = Whisper.View.extend({ className: 'toast', initialize: function() {