r60604 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60603‎ | r60604 | r60605 >
Date:16:03, 4 January 2010
Author:catrope
Status:ok
Tags:
Comment:
UsabilityInitiative: Don't load unneeded JS for Vector modules in non-Vector skins, fix comment
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.php
@@ -8,9 +8,9 @@
99 * This file contains the main include file for the UsabilityInitiative
1010 * extension of MediaWiki.
1111 *
12 - * Usage: Inlcude the modules you want to use specifically by adding a line in
 12+ * Usage: Include the modules you want to use specifically by adding a line in
1313 * LocalSettings.php for each of them like this:
14 - * require_once( "$IP/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php" );
 14+ * require_once( "$IP/extensions/UsabilityInitiative/Vector/Vector.php" );
1515 *
1616 * @author Trevor Parscal <tparscal@wikimedia.org>
1717 * Allow "or a later version" here?
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -70,6 +70,13 @@
7171 global $wgUser, $wgJsMimeType, $wgOut;
7272 global $wgVectorModules, $wgUsabilityInitiativeResourceMode;
7373
 74+ // Don't load Vector modules for non-Vector skins
 75+ // They won't work but will throw unused JS in the client's face
 76+ // Using instanceof to catch any skins subclassing Vector
 77+ if ( !$wgUser->getSkin() instanceof SkinVector ) {
 78+ return true;
 79+ }
 80+
7481 // Modules
7582 $preferences = array();
7683 $enabledModules = array();

Status & tagging log