r110933 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110932‎ | r110933 | r110934 >
Date:14:07, 8 February 2012
Author:johnduhart
Status:ok (Comments)
Tags:miscextensions 
Comment:
Followup r98500, fixes flash of unstyled content
Modified paths:
  • /trunk/extensions/CategoryTree/CategoryTree.php (modified) (history)
  • /trunk/extensions/CategoryTree/CategoryTreeFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryTree/CategoryTree.php
@@ -139,10 +139,12 @@
140140 /**
141141 * Register ResourceLoader modules
142142 */
143 -$wgResourceModules['ext.categoryTree'] = array(
 143+$commonModuleInfo = array(
144144 'localBasePath' => dirname( __FILE__ ) . '/modules',
145145 'remoteExtPath' => 'CategoryTree/modules',
146 - 'styles' => 'ext.categoryTree.css',
 146+);
 147+
 148+$wgResourceModules['ext.categoryTree'] = array(
147149 'scripts' => 'ext.categoryTree.js',
148150 'messages' => array(
149151 'categorytree-collapse',
@@ -158,8 +160,12 @@
159161 'categorytree-error',
160162 'categorytree-retry',
161163 ),
162 -);
 164+) + $commonModuleInfo;
163165
 166+$wgResourceModules['ext.categoryTree.css'] = array(
 167+ 'styles' => 'ext.categoryTree.css',
 168+) + $commonModuleInfo;
 169+
164170 /**
165171 * Hook it up
166172 */
Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php
@@ -161,7 +161,8 @@
162162 * @param OutputPage $outputPage
163163 */
164164 static function setHeaders( $outputPage ) {
165 - # Add the module
 165+ # Add the modules
 166+ $outputPage->addModuleStyles( 'ext.categoryTree.css' );
166167 $outputPage->addModules( 'ext.categoryTree' );
167168 }
168169

Follow-up revisions

RevisionCommit summaryAuthorDate
r113035MFT r110933, r111011, r111218, r112751, r112925, r112993reedy14:31, 5 March 2012
r113037MFT r110703, r110933, r111011, r111218, r112520, r112524, r112660, r112687, r...reedy14:59, 5 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98500Basic ResourceLoader conversion, jQuery conversion and API use will come soonjohnduhart02:51, 30 September 2011

Comments

#Comment by Catrope (talk | contribs)   23:23, 8 February 2012

I was gonna say that you need to add the modules to the ParserOutput object too, but it looks like CategoryTree has reinvented the wheel in a clever way, by setting $parserOutput->mCategoryTreeTag in the parser hook and reading it out in an OutputPageParserOutput hook. This could be cleaned up, but it's fine for now.

Status & tagging log