http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96567
Revision: 96567
Author: catrope
Date: 2011-09-08 14:44:42 +0000 (Thu, 08 Sep 2011)
Log Message:
-----------
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: trunk/extensions/Narayam/js/ext.narayam.core.js
===================================================================
--- trunk/extensions/Narayam/js/ext.narayam.core.js 2011-09-08 14:23:52 UTC
(rev 96566)
+++ trunk/extensions/Narayam/js/ext.narayam.core.js 2011-09-08 14:44:42 UTC
(rev 96567)
@@ -82,7 +82,7 @@
if ( pos <= n ) {
return str.substr( 0, pos );
} else {
- return str.substr( pos - n, n);
+ return str.substr( pos - n, n );
}
}
@@ -252,7 +252,7 @@
replaceString($this, startPos - input.length + 1,
endPos, replacement);
// Calculate new position for caret to be set
- var newCaretPosition = startPos - input.length + 1 +
replacement.length
+ var newCaretPosition = startPos - input.length + 1 +
replacement.length;
// Update caret postion
$this.textSelection( 'setSelection', {
'start': newCaretPosition,
@@ -307,10 +307,10 @@
// We can use jQuery's .live() instead of .bind()
// So Narayam can work on elements added later to DOM
too
$( inputs )
- .live('keydown', onkeydown)
- .live('keypress', onkeypress)
- .live('focus', onfocus)
- .live('blur', onblur);
+ .live( 'keydown', onkeydown )
+ .live( 'keypress', onkeypress )
+ .live( 'focus', onfocus )
+ .live( 'blur', onblur );
} else {
var $newInputs = $( inputs );
$inputs = $inputs.add( $newInputs );
@@ -465,23 +465,23 @@
var haveSchemes = false;
// Build schemes option list
var $narayamMenuItems = $( '<ul/>' );
- for ( scheme in schemes ) {
- $input = $( '<input type="radio"
name="narayam-input-method" class="narayam-scheme" />' );
+ for ( var scheme in schemes ) {
+ var $input = $( '<input type="radio"
name="narayam-input-method" class="narayam-scheme" />' );
$input
.attr( 'id', 'narayam-' + scheme )
.val( scheme );
- $narayamMenuItemLabel=$( '<label />' )
- .attr("for",'narayam-' + scheme)
- .append( $input)
+ var $narayamMenuItemLabel = $( '<label />' )
+ .attr( 'for' ,'narayam-' + scheme )
+ .append( $input )
.append( mw.msg(
schemes[scheme].namemsg ) );
var $narayamMenuItem = $( '<li/>' )
.append( $input )
- .append($narayamMenuItemLabel);
+ .append( $narayamMenuItemLabel );
haveSchemes = true;
- $narayamMenuItems.append($narayamMenuItem);
+ $narayamMenuItems.append( $narayamMenuItem );
}
if ( !haveSchemes ) {
@@ -493,7 +493,7 @@
// Event listener for scheme selection.
// There is a plan to add a feature that allow dynamic loading
of schemes.
// So .live will be useful
- $( '.narayam-scheme', $( '#narayam-menu-items > ul')[0] ).live(
'click', function(){
+ $( '.narayam-scheme', $( '#narayam-menu-items > ul')[0] ).live(
'click', function() {
that.setScheme( $(this).val() );
} );
@@ -553,17 +553,16 @@
// coming on top of everything.
// TODO: is there a better solution other than hiding it on
hover?
if ( $.browser.msie ) {
- $( "#narayam-menu" ).hover(function(){
- $( "#searchform" ).css({ visibility: "hidden"
});
- },function(){
- $( "#searchform" ).css({ visibility: "visible"
});
+ $( "#narayam-menu" ).hover( function() {
+ $( "#searchform" ).css( { visibility: "hidden"
} );
+ }, function() {
+ $( "#searchform" ).css( { visibility: "visible"
} );
});
}
// Narayam controls setup complete, returns true
return true;
- }
-
+ };
} )();
} )( jQuery );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs