Gerrit Patch Uploader has uploaded a new change for review.

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

Change subject: Hide toggle buttons via CSS for clients without JavaScript
......................................................................

Hide toggle buttons via CSS for clients without JavaScript

* This also avoids rerendering while loading for clients with JavaScript

Change-Id: I42678b87af84dee49ca06d950d8beddcc3b7a9f4
---
M CategoryTreeFunctions.php
M modules/ext.categoryTree.css
M modules/ext.categoryTree.js
3 files changed, 5 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CategoryTree 
refs/changes/48/267648/1

diff --git a/CategoryTreeFunctions.php b/CategoryTreeFunctions.php
index 45dae51..77a86e2 100644
--- a/CategoryTreeFunctions.php
+++ b/CategoryTreeFunctions.php
@@ -631,7 +631,6 @@
                                $linkattr = array( );
 
                                $linkattr[ 'class' ] = "CategoryTreeToggle";
-                               $linkattr['style'] = 'display: none;'; // 
Unhidden by JS
                                $linkattr['data-ct-title'] = $key;
 
                                $tag = 'span';
diff --git a/modules/ext.categoryTree.css b/modules/ext.categoryTree.css
index 21192ee..8e6ffc1 100644
--- a/modules/ext.categoryTree.css
+++ b/modules/ext.categoryTree.css
@@ -45,6 +45,11 @@
        speak: none;
 }
 
+/* Hide toggle buttons for clients without JavaScript */
+.client-nojs .CategoryTreeToggle {
+       display: none;
+}
+
 .CategoryTreeToggle {
        color: #0645AD;
 }
diff --git a/modules/ext.categoryTree.js b/modules/ext.categoryTree.js
index 611ed77..8e5cde6 100644
--- a/modules/ext.categoryTree.js
+++ b/modules/ext.categoryTree.js
@@ -13,13 +13,6 @@
        mw.hook( 'wikipage.content' ).add( function ( $content ) {
 
                /**
-                * Sets display inline to tree toggle
-                */
-               function showToggles() {
-                       $content.find( 'span.CategoryTreeToggle' ).css( 
'display', 'inline' );
-               }
-
-               /**
                 * Handles clicks on the expand buttons, and calls the 
appropriate function
                 *
                 * @context {Element} CategoryTreeToggle
@@ -161,14 +154,12 @@
                                        .find( '.CategoryTreeToggle' )
                                                .click( handleNode );
 
-                               showToggles();
                        } )
                        .fail( error );
                }
 
                // Register click events and show toggle buttons
                $content.find( '.CategoryTreeToggle' ).click( handleNode );
-               showToggles();
        } );
 
 }( jQuery, mediaWiki ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42678b87af84dee49ca06d950d8beddcc3b7a9f4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CategoryTree
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <[email protected]>

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

Reply via email to