r96185 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96184‎ | r96185 | r96186 >
Date:13:55, 3 September 2011
Author:santhosh
Status:ok
Tags:
Comment:
Use hasClass instead of .is . And small cleanup of the code with oneliner.
Modified paths:
  • /trunk/extensions/Narayam/js/ext.narayam.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Narayam/js/ext.narayam.core.js
@@ -455,13 +455,9 @@
456456 $li
457457 .append( $menu );
458458
459 - // If rtl, add to the right of top personal links, else, to the left
460 - if($('body').is( '.rtl' ) ){
461 - $($('#p-personal ul')[0]).append( $li );
462 - }
463 - else{
464 - $($('#p-personal ul')[0]).prepend( $li );
465 - }
 459+ //if rtl, add to the right of top personal links. Else, to the left
 460+ var fn = $('body').hasClass( 'rtl' ) ? "append" : "prepend";
 461+ $('#p-personal ul:first')[fn]( $li );
466462
467463 // Build enable/disable checkbox and label
468464 $checkbox = $( '<input type="checkbox" id="narayam-toggle" />' );

Status & tagging log