r96567 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96566‎ | r96567 | r96568 >
Date:14:44, 8 September 2011
Author:catrope
Status:ok
Tags:
Comment:
JSHint and whitespace fixes, mostly missing semicolons and missing 'var's. Code introduced in a variety of revs but mostly in r96190
Modified paths:
  • /trunk/extensions/Narayam/js/ext.narayam.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Narayam/js/ext.narayam.core.js
@@ -82,7 +82,7 @@
8383 if ( pos <= n ) {
8484 return str.substr( 0, pos );
8585 } else {
86 - return str.substr( pos - n, n);
 86+ return str.substr( pos - n, n );
8787 }
8888 }
8989
@@ -252,7 +252,7 @@
253253
254254 replaceString($this, startPos - input.length + 1, endPos, replacement);
255255 // Calculate new position for caret to be set
256 - var newCaretPosition = startPos - input.length + 1 + replacement.length
 256+ var newCaretPosition = startPos - input.length + 1 + replacement.length;
257257 // Update caret postion
258258 $this.textSelection( 'setSelection', {
259259 'start': newCaretPosition,
@@ -307,10 +307,10 @@
308308 // We can use jQuery's .live() instead of .bind()
309309 // So Narayam can work on elements added later to DOM too
310310 $( inputs )
311 - .live('keydown', onkeydown)
312 - .live('keypress', onkeypress)
313 - .live('focus', onfocus)
314 - .live('blur', onblur);
 311+ .live( 'keydown', onkeydown )
 312+ .live( 'keypress', onkeypress )
 313+ .live( 'focus', onfocus )
 314+ .live( 'blur', onblur );
315315 } else {
316316 var $newInputs = $( inputs );
317317 $inputs = $inputs.add( $newInputs );
@@ -465,23 +465,23 @@
466466 var haveSchemes = false;
467467 // Build schemes option list
468468 var $narayamMenuItems = $( '<ul/>' );
469 - for ( scheme in schemes ) {
470 - $input = $( '<input type="radio" name="narayam-input-method" class="narayam-scheme" />' );
 469+ for ( var scheme in schemes ) {
 470+ var $input = $( '<input type="radio" name="narayam-input-method" class="narayam-scheme" />' );
471471 $input
472472 .attr( 'id', 'narayam-' + scheme )
473473 .val( scheme );
474474
475 - $narayamMenuItemLabel=$( '<label />' )
476 - .attr("for",'narayam-' + scheme)
477 - .append( $input)
 475+ var $narayamMenuItemLabel = $( '<label />' )
 476+ .attr( 'for' ,'narayam-' + scheme )
 477+ .append( $input )
478478 .append( mw.msg( schemes[scheme].namemsg ) );
479479
480480 var $narayamMenuItem = $( '<li/>' )
481481 .append( $input )
482 - .append($narayamMenuItemLabel);
 482+ .append( $narayamMenuItemLabel );
483483
484484 haveSchemes = true;
485 - $narayamMenuItems.append($narayamMenuItem);
 485+ $narayamMenuItems.append( $narayamMenuItem );
486486 }
487487
488488 if ( !haveSchemes ) {
@@ -493,7 +493,7 @@
494494 // Event listener for scheme selection.
495495 // There is a plan to add a feature that allow dynamic loading of schemes.
496496 // So .live will be useful
497 - $( '.narayam-scheme', $( '#narayam-menu-items > ul')[0] ).live( 'click', function(){
 497+ $( '.narayam-scheme', $( '#narayam-menu-items > ul')[0] ).live( 'click', function() {
498498 that.setScheme( $(this).val() );
499499 } );
500500
@@ -553,17 +553,16 @@
554554 // coming on top of everything.
555555 // TODO: is there a better solution other than hiding it on hover?
556556 if ( $.browser.msie ) {
557 - $( "#narayam-menu" ).hover(function(){
558 - $( "#searchform" ).css({ visibility: "hidden" });
559 - },function(){
560 - $( "#searchform" ).css({ visibility: "visible" });
 557+ $( "#narayam-menu" ).hover( function() {
 558+ $( "#searchform" ).css( { visibility: "hidden" } );
 559+ }, function() {
 560+ $( "#searchform" ).css( { visibility: "visible" } );
561561 });
562562 }
563563
564564 // Narayam controls setup complete, returns true
565565 return true;
566 - }
567 -
 566+ };
568567 } )();
569568
570569 } )( jQuery );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96190Make the labels of input method menu clickable.santhosh14:38, 3 September 2011

Status & tagging log