r106202 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106201‎ | r106202 | r106203 >
Date:14:39, 14 December 2011
Author:amire80
Status:ok
Tags:
Comment:
Followup to r106197, whitespace cleanup.
Modified paths:
  • /trunk/extensions/WebFonts/resources/ext.webfonts.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WebFonts/resources/ext.webfonts.js
@@ -349,38 +349,32 @@
350350
351351 // This is the fonts link
352352 var $li = $( '<li>' ).attr( 'id', 'pt-webfont' ).append( $link );
353 - var positionFunction;
354 - if ( $( 'body' ).hasClass( 'rtl' ) ) {
355 - positionFunction = 'append';
356 - }
357 - else {
358 - positionFunction = 'prepend';
359 - }
 353+
 354+ var rtlEnv = $( 'body' ).hasClass( 'rtl' );
 355+
360356 // If RTL, add to the right of top personal links. Else, to the left
 357+ var positionFunction = rtlEnv ? 'append' : 'prepend';
361358 $( '#p-personal ul:first' )[positionFunction]( $li );
362359
363360 $( 'body' ).prepend( $menu );
364361 $li.click( function( event ) {
365362 var menuSide, menuOffset, distanceToEdge;
366363
367 - if ( $( 'body' ).hasClass( 'rtl' ) ) {
 364+ if ( rtlEnv ) {
368365 distanceToEdge = $li.outerWidth() + $li.offset().left;
369366 if ( $menuItemsDiv.outerWidth() > distanceToEdge ) {
370367 menuSide = 'left';
371368 menuOffset = $li.offset().left;
372 - }
373 - else {
 369+ } else {
374370 menuSide = 'right';
375371 menuOffset = $(window).width() - distanceToEdge;
376372 }
377 - }
378 - else {
 373+ } else {
379374 distanceToEdge = $(window).width() - $li.offset().left;
380375 if ( $menuItemsDiv.outerWidth() > distanceToEdge ) {
381376 menuSide = 'right';
382377 menuOffset = distanceToEdge - $li.outerWidth();
383 - }
384 - else {
 378+ } else {
385379 menuSide = 'left';
386380 menuOffset = $li.offset().left;
387381 }
@@ -390,8 +384,7 @@
391385
392386 if ( $menu.hasClass( 'open' ) ) {
393387 $menu.removeClass( 'open' );
394 - }
395 - else {
 388+ } else {
396389 $( 'div.open' ).removeClass( 'open' );
397390 $menu.addClass( 'open' );
398391 event.stopPropagation();

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106197Better fix for bug 33095. Making the orientation of the drop-down menu condit...amire8014:08, 14 December 2011

Status & tagging log