Index: trunk/extensions/Narayam/js/ext.narayam.core.js |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | if ( pos <= n ) { |
84 | 84 | return str.substr( 0, pos ); |
85 | 85 | } else { |
86 | | - return str.substr( pos - n, n); |
| 86 | + return str.substr( pos - n, n ); |
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
— | — | @@ -252,7 +252,7 @@ |
253 | 253 | |
254 | 254 | replaceString($this, startPos - input.length + 1, endPos, replacement); |
255 | 255 | // 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; |
257 | 257 | // Update caret postion |
258 | 258 | $this.textSelection( 'setSelection', { |
259 | 259 | 'start': newCaretPosition, |
— | — | @@ -307,10 +307,10 @@ |
308 | 308 | // We can use jQuery's .live() instead of .bind() |
309 | 309 | // So Narayam can work on elements added later to DOM too |
310 | 310 | $( 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 ); |
315 | 315 | } else { |
316 | 316 | var $newInputs = $( inputs ); |
317 | 317 | $inputs = $inputs.add( $newInputs ); |
— | — | @@ -465,23 +465,23 @@ |
466 | 466 | var haveSchemes = false; |
467 | 467 | // Build schemes option list |
468 | 468 | 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" />' ); |
471 | 471 | $input |
472 | 472 | .attr( 'id', 'narayam-' + scheme ) |
473 | 473 | .val( scheme ); |
474 | 474 | |
475 | | - $narayamMenuItemLabel=$( '<label />' ) |
476 | | - .attr("for",'narayam-' + scheme) |
477 | | - .append( $input) |
| 475 | + var $narayamMenuItemLabel = $( '<label />' ) |
| 476 | + .attr( 'for' ,'narayam-' + scheme ) |
| 477 | + .append( $input ) |
478 | 478 | .append( mw.msg( schemes[scheme].namemsg ) ); |
479 | 479 | |
480 | 480 | var $narayamMenuItem = $( '<li/>' ) |
481 | 481 | .append( $input ) |
482 | | - .append($narayamMenuItemLabel); |
| 482 | + .append( $narayamMenuItemLabel ); |
483 | 483 | |
484 | 484 | haveSchemes = true; |
485 | | - $narayamMenuItems.append($narayamMenuItem); |
| 485 | + $narayamMenuItems.append( $narayamMenuItem ); |
486 | 486 | } |
487 | 487 | |
488 | 488 | if ( !haveSchemes ) { |
— | — | @@ -493,7 +493,7 @@ |
494 | 494 | // Event listener for scheme selection. |
495 | 495 | // There is a plan to add a feature that allow dynamic loading of schemes. |
496 | 496 | // 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() { |
498 | 498 | that.setScheme( $(this).val() ); |
499 | 499 | } ); |
500 | 500 | |
— | — | @@ -553,17 +553,16 @@ |
554 | 554 | // coming on top of everything. |
555 | 555 | // TODO: is there a better solution other than hiding it on hover? |
556 | 556 | 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" } ); |
561 | 561 | }); |
562 | 562 | } |
563 | 563 | |
564 | 564 | // Narayam controls setup complete, returns true |
565 | 565 | return true; |
566 | | - } |
567 | | - |
| 566 | + }; |
568 | 567 | } )(); |
569 | 568 | |
570 | 569 | } )( jQuery ); |