Jack Phoenix has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/220472

Change subject: Removing pointless conditions
......................................................................

Removing pointless conditions

If and when we explicitly set the variable to true right before it's
evaluated, it obviously cannot ever be false.

Change-Id: If606fc9d3b384db78dc4f42cf3916e80818a808d
---
M js/metrolook.js
1 file changed, 27 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Metrolook 
refs/changes/72/220472/1

diff --git a/js/metrolook.js b/js/metrolook.js
index 1383fb7..b287d7d 100644
--- a/js/metrolook.js
+++ b/js/metrolook.js
@@ -5,7 +5,7 @@
        } );
 }
 
-$( document ).click( function(e) {
+$( document ).click( function( e ) {
        if ( !$( e.target ).closest( '#' + openDiv ).length ) {
                toggleDiv( openDiv );
        }
@@ -39,7 +39,7 @@
 $( function () {
        if ( is_touch_device() ) {
                if ( 
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|CriOS|Opera 
Mini|Mobile|mobile/i.test( navigator.userAgent ) ) {
-                       $( '.actionmenu > div' ).toggleClass('no-js js');
+                       $( '.actionmenu > div' ).toggleClass( 'no-js js' );
                        $( '.actionmenu .js div' ).hide();
                        $( '.actionmenu .js' ).click( function( e ) {
                                $( '.actionmenu .js div' ).fadeToggle( 150 );
@@ -47,7 +47,7 @@
                                e.stopPropagation();
                        } );
 
-                       $( document ).click(function() {
+                       $( document ).click( function() {
                                if ( $( '.actionmenu .js div' ).is( ':visible' 
) ) {
                                        $( '.actionmenu .js div', this 
).fadeOut( 150 );
                                        $( '.clicker' ).removeClass( 'active' );
@@ -88,44 +88,34 @@
 $( function () {
        if ( is_touch_device() ) {
                if ( 
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|CriOS|Opera 
Mini|Mobile|mobile/i.test( navigator.userAgent ) ) {
-                       var $wgMetrolookMobile = true;
-                       if ( $wgMetrolookMobile ) {
-                               $( '#p-search' ).hide();
-                               $( 'img.searchbar' ).click( function( e ) {
-                                       $( '#p-search' ).fadeToggle( 150 );
-                                       $( '.clicker' ).toggleClass( 'active' );
-                                       e.stopPropagation();
-                               } );
-                               $( 'img.searchbar' ).click( function() {
-                                       if ( $( '#p-search' ).is( ':visible' ) 
) {
-                                               $( '#p-search', this ).fadeOut( 
150 );
-                                               $( '.clicker' ).removeClass( 
'active' );
-                                       }
-                               } );
-                       } else {
-                               $( 'img.searchbar' ).hide();
-                       }
+                       $( '#p-search' ).hide();
+                       $( 'img.searchbar' ).click( function( e ) {
+                               $( '#p-search' ).fadeToggle( 150 );
+                               $( '.clicker' ).toggleClass( 'active' );
+                               e.stopPropagation();
+                       } );
+                       $( 'img.searchbar' ).click( function() {
+                               if ( $( '#p-search' ).is( ':visible' ) ) {
+                                       $( '#p-search', this ).fadeOut( 150 );
+                                       $( '.clicker' ).removeClass( 'active' );
+                               }
+                       } );
                }
        }
-});
+} );
 
 $( function () {
-       var $wgMetrolookMobile = true;
-       if ( $wgMetrolookMobile ) {
-               $( 'img.editbutton' ).click( function( e ) {
-                       $( '#left-navigation' ).fadeToggle( 150 );
-                       $( '.clicker' ).toggleClass( 'active' );
-                       e.stopPropagation();
-               } );
-               $( 'img.editbutton' ).click( function() {
-                       if ( $( '#left-navigation' ).is( ':visible' ) ) {
-                               $( '#left-navigation', this ).fadeOut( 150 );
-                               $( '.clicker' ).removeClass( 'active' );
-                       }
-               } );
-       } else {
-               $( 'img.editbutton' ).hide();
-       }
+       $( 'img.editbutton' ).click( function( e ) {
+               $( '#left-navigation' ).fadeToggle( 150 );
+               $( '.clicker' ).toggleClass( 'active' );
+               e.stopPropagation();
+       } );
+       $( 'img.editbutton' ).click( function() {
+               if ( $( '#left-navigation' ).is( ':visible' ) ) {
+                       $( '#left-navigation', this ).fadeOut( 150 );
+                       $( '.clicker' ).removeClass( 'active' );
+               }
+       } );
 } );
 
 $( function () {

-- 
To view, visit https://gerrit.wikimedia.org/r/220472
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If606fc9d3b384db78dc4f42cf3916e80818a808d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Metrolook
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to