r59836 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59835‎ | r59836 | r59837 >
Date:18:07, 8 December 2009
Author:catrope
Status:ok
Tags:
Comment:
UsabilityInitiative: Use BeforePageDisplay hook instead of AjaxAddScript, the latter requires that $wgUseAjax be set to true
Modified paths:
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/Vector/Vector.php
@@ -49,5 +49,5 @@
5050 $wgExtensionMessagesFiles['VectorSimpleSearch'] = dirname( __FILE__ ) . '/Modules/SimpleSearch/SimpleSearch.i18n.php';
5151
5252 // Register Hooks
53 -$wgHooks['AjaxAddScript'][] = 'VectorHooks::addModules';
 53+$wgHooks['BeforePageDisplay'][] = 'VectorHooks::addModules';
5454 $wgHooks['GetPreferences'][] = 'VectorHooks::addPreferences';
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -61,11 +61,11 @@
6262 */
6363
6464 /**
65 - * AjaxAddScript hook
 65+ * BeforePageDislay hook
6666 * Adds the modules to the edit form
6767 */
68 - public static function addModules( &$toolbar ) {
69 - global $wgOut, $wgUser, $wgJsMimeType;
 68+ public static function addModules( &$out, &$sk ) {
 69+ global $wgUser, $wgJsMimeType;
7070 global $wgVectorModules, $wgUsabilityInitiativeResourceMode;
7171
7272 // Modules
@@ -111,7 +111,7 @@
112112 );
113113 }
114114 // Preferences (maybe the UsabilityInitiative class could do most of this for us?)
115 - $wgOut->addScript(
 115+ $out->addScript(
116116 Xml::tags(
117117 'script',
118118 array( 'type' => $wgJsMimeType ),

Status & tagging log