Skip to content

Commit 554b7b1

Browse files
committed
Moving and combining var declarations to comply with JS style guidelines
1 parent b77406c commit 554b7b1

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

code_comments/htdocs/code-comments.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function($) { $(function() {
2-
var jQuery = $; // just in case something uses jQuery() instead of $()
3-
var _ = window.underscore;
2+
var _ = window.underscore,
3+
jQuery = $; // just in case something uses jQuery() instead of $()
44
$(document).ajaxError( function(e, xhr, options){
55
var errorText = xhr.statusText;
66
if (-1 == xhr.responseText.indexOf('<html')) {
@@ -156,13 +156,12 @@
156156
this.$("ul.comments").append(view.render().el);
157157
},
158158
showAddCommentDialog: function() {
159-
var $parentRow = $( this.el ).prev()[0];
160-
var $th = ( $( 'th', $parentRow ).length) ? $( 'th', $parentRow ) : $parentRow,
159+
var $parentRow = $( this.el ).prev()[0],
160+
$th = ( $( 'th', $parentRow ).length) ? $( 'th', $parentRow ) : $parentRow,
161161
$item = $th.last(),
162162
file = $item.parents( 'li' ).find( 'h2>a:first' ).text(),
163-
line = $.inArray( $parentRow, CodeComments.$tableRows ) + 1;
164-
165-
var displayLine = $item.text().trim() || $th.first().text() + ' (deleted)';
163+
line = $.inArray( $parentRow, CodeComments.$tableRows ) + 1,
164+
displayLine = $item.text().trim() || $th.first().text() + ' (deleted)';
166165

167166
AddCommentDialog.open( LineComments, this.line, file, displayLine );
168167
}
@@ -185,9 +184,9 @@
185184
return this;
186185
},
187186
open: function( collection, line, file, displayLine ) {
187+
var title = this.buildDialogTitle( line, file, displayLine );
188188
this.line = line;
189189
this.collection = collection;
190-
var title = this.buildDialogTitle( line, file, displayLine );
191190
this.$el.dialog( 'open' ).dialog( { title: title } );
192191
},
193192
buildDialogTitle: function( line, file, displayLine ) {
@@ -242,9 +241,8 @@
242241
var $th = ( $( 'th', this ).length) ? $( 'th', this ) : $( this ),
243242
$item = $th.last(),
244243
file = $item.parents( 'li' ).find( 'h2>a:first' ).text(),
245-
line = $.inArray( this, CodeComments.$tableRows ) + 1;
246-
247-
var displayLine = $item.text().trim() || $th.first().text() + ' (deleted)';
244+
line = $.inArray( this, CodeComments.$tableRows ) + 1,
245+
displayLine = $item.text().trim() || $th.first().text() + ' (deleted)';
248246

249247
$item.children().css( 'display', 'none' );
250248

0 commit comments

Comments
 (0)