jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/337892 )

Change subject: Coding style tweaks
......................................................................


Coding style tweaks

* spaces -> tabs for indentation
* static {public,private} function -> {public,private} static function
* renamed ResourceLoader module from ext.Tabber to ext.tabber
* cleaned up the usage of temporary variables in the PHP entry point
* documentation tweaks
* lowercased CSS color values

Change-Id: Ic08bc6ac770332f094895e23dc2a10e4a4ded4b7
---
M Tabber.hooks.php
M Tabber.php
M css/tabber.css
M extension.json
M js/tabber.js
5 files changed, 98 insertions(+), 97 deletions(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  SamanthaNguyen: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/Tabber.hooks.php b/Tabber.hooks.php
index c997a82..848710e 100644
--- a/Tabber.hooks.php
+++ b/Tabber.hooks.php
@@ -7,60 +7,58 @@
  * @license            GPL
  * @package            Tabber
  * @link               https://www.mediawiki.org/wiki/Extension:Tabber
- *
-**/
+ */
 class TabberHooks {
        /**
         * Sets up this extension's parser functions.
         *
-        * @access      public
-        * @param       object  Parser object passed as a reference.
-        * @return      boolean true
+        * @param Parser $parser Parser object passed as a reference.
+        * @return bool
         */
-       static public function onParserFirstCallInit(Parser &$parser) {
-               $parser->setHook("tabber", "TabberHooks::renderTabber");
+       public static function onParserFirstCallInit( Parser &$parser ) {
+               $parser->setHook( 'tabber', 'TabberHooks::renderTabber' );
                return true;
        }
+
        /**
         * Renders the necessary HTML for a <tabber> tag.
         *
-        * @access      public
-        * @param       string  The input URL between the beginning and ending 
tags.
-        * @param       array   Array of attribute arguments on that beginning 
tag.
-        * @param       object  Mediawiki Parser Object
-        * @param       object  Mediawiki PPFrame Object
-        * @return      string  HTML
+        * @param string $input The input URL between the beginning and ending 
tags.
+        * @param array $args Array of attribute arguments on that beginning 
tag.
+        * @param Parser $parser
+        * @param PPFrame $frame
+        * @return string HTML
         */
-       static public function renderTabber($input, array $args, Parser 
$parser, PPFrame $frame) {
-               $parser->getOutput()->addModules('ext.Tabber');
-               $key = md5($input);
-               $arr = explode("|-|", $input);
+       public static function renderTabber( $input, array $args, Parser 
$parser, PPFrame $frame ) {
+               $parser->getOutput()->addModules( 'ext.tabber' );
+               $key = md5( $input );
+               $arr = explode( '|-|', $input );
                $htmlTabs = '';
-               foreach ($arr as $tab) {
-                       $htmlTabs .= self::buildTab($tab, $parser, $frame);
+               foreach ( $arr as $tab ) {
+                       $htmlTabs .= self::buildTab( $tab, $parser, $frame );
                }
-               $HTML = '<div id="tabber-'.$key.'" 
class="tabber">'.$htmlTabs."</div>";
+               $HTML = '<div id="tabber-' . $key . '" class="tabber">' . 
$htmlTabs . '</div>';
                return $HTML;
        }
+
        /**
         * Build individual tab.
         *
-        * @access      private
-        * @param       string  Tab information
-        * @param       object  Mediawiki Parser Object
-        * @param       object  Mediawiki PPFrame Object
-        * @return      string  HTML
+        * @param string Tab information
+        * @param Parser $parser
+        * @param PPFrame $frame
+        * @return string HTML
         */
-       static private function buildTab($tab = '', Parser $parser, PPFrame 
$frame) {
-               $tab = trim($tab);
-               if (empty($tab)) {
+       private static function buildTab( $tab = '', Parser $parser, PPFrame 
$frame ) {
+               $tab = trim( $tab );
+               if ( empty( $tab ) ) {
                        return $tab;
                }
-               list($tabName, $tabBody) = explode('=', $tab, 2);
-               $tabBody = $parser->recursiveTagParse($tabBody, $frame);
+               list( $tabName, $tabBody ) = explode( '=', $tab, 2 );
+               $tabBody = $parser->recursiveTagParse( $tabBody, $frame );
                $tab = '
-                       <div class="tabbertab" 
title="'.htmlspecialchars($tabName).'">
-                               <p>'.$tabBody.'</p>
+                       <div class="tabbertab" title="' . htmlspecialchars( 
$tabName ) . '">
+                               <p>' . $tabBody . '</p>
                        </div>';
                return $tab;
        }
diff --git a/Tabber.php b/Tabber.php
index fc7872d..abd3504 100644
--- a/Tabber.php
+++ b/Tabber.php
@@ -7,12 +7,11 @@
  * @license            GPL
  * @package            Tabber
  * @link               https://www.mediawiki.org/wiki/Extension:Tabber
- *
-**/
+ */
 /******************************************/
 /* Credits                                */
 /******************************************/
-$credits = [
+$wgExtensionCredits['parserhook'][] = [
        'path'                          => __FILE__,
        'name'                          => 'Tabber',
        'author'                        => ['Eric Fortin', 'Alexia E. Smith'],
@@ -20,16 +19,15 @@
        'descriptionmsg'        => 'tabber-desc',
        'version'                       => '2.4'
 ];
-$wgExtensionCredits['parserhook'][] = $credits;
+
 /******************************************/
-/* Language Strings, Page Aliases, Hooks  */
+/* Language Strings, Hooks  */
 /******************************************/
-$extDir = __DIR__.'/';
-$wgMessagesDirs['Tabber']                                      = 
"{$extDir}/i18n";
-$wgExtensionMessagesFiles['Tabber']                    = 
"{$extDir}/Tabber.i18n.php";
-$wgAutoloadClasses['TabberHooks']                      = 
"{$extDir}/Tabber.hooks.php";
+$wgMessagesDirs['Tabber']                                      = __DIR__ . 
'/i18n';
+$wgExtensionMessagesFiles['Tabber']                    = __DIR__ . 
'/Tabber.i18n.php';
+$wgAutoloadClasses['TabberHooks']                      = __DIR__ . 
'/Tabber.hooks.php';
 $wgHooks['ParserFirstCallInit'][]                      = 
'TabberHooks::onParserFirstCallInit';
-$wgResourceModules['ext.Tabber']                       = [
+$wgResourceModules['ext.tabber']                       = [
        'localBasePath' => __DIR__,
        'remoteExtPath' => 'Tabber',
        'styles'                => ['css/tabber.css'],
diff --git a/css/tabber.css b/css/tabber.css
index daece02..10b6bf1 100644
--- a/css/tabber.css
+++ b/css/tabber.css
@@ -1,52 +1,52 @@
 ul.tabbernav {
-    margin: 0;
-    padding: 3px 0;
-    border-bottom: 1px solid #CCC;
-    font: bold 12px Verdana, sans-serif;
+       margin: 0;
+       padding: 3px 0;
+       border-bottom: 1px solid #ccc;
+       font: bold 12px Verdana, sans-serif;
 }
 
 ul.tabbernav li {
-    list-style: none;
-    margin: 0;
-    display: inline;
+       list-style: none;
+       margin: 0;
+       display: inline;
 }
 
 ul.tabbernav li a {
-    padding: 3px .5em;
-    margin-left: 3px;
-    border: 1px solid #CCC;
-    border-bottom: none;
-    background: #F2F7FF;
-    text-decoration: none;
+       padding: 3px .5em;
+       margin-left: 3px;
+       border: 1px solid #ccc;
+       border-bottom: none;
+       background: #f2f7ff;
+       text-decoration: none;
 }
 
 ul.tabbernav li a:link {
-    color: #448;
+       color: #448;
 }
 
 ul.tabbernav li a:visited {
-    color: #667;
+       color: #667;
 }
 
 ul.tabbernav li a:hover {
-    color: #000;
-    background: #FFF9F2;
-    border-color: #CCC;
+       color: #000;
+       background: #fff9f2;
+       border-color: #ccc;
 }
 
 ul.tabbernav li.tabberactive a {
-    background-color: #FFF;
-    border-bottom: 1px solid #FFF;
+       background-color: #fff;
+       border-bottom: 1px solid #fff;
 }
 
 ul.tabbernav li.tabberactive a:hover {
-    color: #000;
-    background: #FFF;
-    border-bottom: 1px solid #FFF;
+       color: #000;
+       background: #fff;
+       border-bottom: 1px solid #fff;
 }
 
 .tabber .tabbertab {
-    padding: 5px;
-    border: 1px solid #CCC;
-    border-top: 0;
+       padding: 5px;
+       border: 1px solid #ccc;
+       border-top: 0;
 }
diff --git a/extension.json b/extension.json
index 6d1c37b..308fb6a 100644
--- a/extension.json
+++ b/extension.json
@@ -17,7 +17,7 @@
                "TabberHooks": "/Tabber.hooks.php"
        },
        "ResourceModules": {
-               "ext.Tabber": {
+               "ext.tabber": {
                        "styles": [
                                "css/tabber.css"
                        ],
diff --git a/js/tabber.js b/js/tabber.js
index 161d856..52bf8d3 100644
--- a/js/tabber.js
+++ b/js/tabber.js
@@ -1,49 +1,54 @@
-(function($) {
+( function( $ ) {
        $.fn.tabber = function() {
-               return this.each(function() {
+               return this.each( function() {
                        // create tabs
-                       var $this = $(this),
-                           tabContent = $this.children('.tabbertab'),
-                           nav = $('<ul>').addClass('tabbernav');
-                       tabContent.each(function() {
-                               var anchor = 
$('<a>').text(this.title).attr('title', this.title).attr('href', 
'javascript:void(0);');
-                               $('<li>').append(anchor).appendTo(nav);
-                       });
-                       $this.prepend(nav);
+                       var $this = $( this ),
+                           tabContent = $this.children( '.tabbertab' ),
+                           nav = $( '<ul>' ).addClass( 'tabbernav' );
+                       tabContent.each( function() {
+                               var anchor = $( '<a>' )
+                                       .text( this.title )
+                                       .attr( 'title', this.title )
+                                       .attr( 'href', 'javascript:void(0);' );
+                               $( '<li>' ).append( anchor ).appendTo( nav );
+                       } );
+                       $this.prepend( nav );
 
                        /**
                         * Internal helper function for showing content
-                        * @param  string title to show, matching only 1 tab
+                        * @param string title to show, matching only 1 tab
                         * @return true if matching tab could be shown
                         */
-                       function showContent(title) {
-                               var content = tabContent.filter('[title="' + 
title + '"]');
-                               if (content.length !== 1) return false;
+                       function showContent( title ) {
+                               var content = tabContent.filter( '[title="' + 
title + '"]' );
+                               if ( content.length !== 1 ) {
+                                       return false;
+                               }
                                tabContent.hide();
                                content.show();
-                               
nav.find('.tabberactive').removeClass('tabberactive');
-                               nav.find('a[title="' + title + 
'"]').parent().addClass('tabberactive');
+                               nav.find( '.tabberactive' ).removeClass( 
'tabberactive' );
+                               nav.find( 'a[title="' + title + '"]' 
).parent().addClass( 'tabberactive' );
                                return true;
                        }
                        // setup initial state
-                       var loc = location.hash.replace('#', '');
-                       if ( loc == '' || !showContent(loc) ) {
-                               showContent(tabContent.first().attr('title'));
+                       var loc = location.hash.replace( '#', '' );
+                       if ( loc == '' || !showContent( loc ) ) {
+                               showContent( tabContent.first().attr( 'title' ) 
);
                        }
 
                        // Repond to clicks on the nav tabs
-                       nav.on('click', 'a', function(e) {
-                               var title = $(this).attr('title');
+                       nav.on( 'click', 'a', function( e ) {
+                               var title = $( this ).attr( 'title' );
                                e.preventDefault();
                                location.hash = '#' + title;
                                showContent( title );
-                       });
+                       } );
 
-                       $this.addClass('tabberlive');
-               });
+                       $this.addClass( 'tabberlive' );
+               } );
        };
-})(jQuery);
+} )( jQuery );
 
-$(function() {
-       $('.tabber').tabber();
-});
+$( function() {
+       $( '.tabber' ).tabber();
+} );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic08bc6ac770332f094895e23dc2a10e4a4ded4b7
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Tabber
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <j...@countervandalism.net>
Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com>
Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net>
Gerrit-Reviewer: SamanthaNguyen <samanthanguyen1...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to