r94318 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94317‎ | r94318 | r94319 >
Date:01:52, 12 August 2011
Author:jlemley
Status:deferred
Tags:
Comment:
Load CSS only if needed.
Modified paths:
  • /trunk/extensions/Favorites/Favorites.php (modified) (history)
  • /trunk/extensions/Favorites/Favorites_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Favorites/Favorites_body.php
@@ -19,7 +19,6 @@
2020 if ($wgArticle) {
2121
2222 if ( $wgUseIconFavorite ) {
23 -
2423 $class = 'icon ';
2524 $place = 'views';
2625 } else {
Index: trunk/extensions/Favorites/Favorites.php
@@ -22,13 +22,11 @@
2323 'name' => 'Favorites',
2424 'author' => 'Jeremy Lemley',
2525 'descriptionmsg' => 'favorites-desc',
26 - 'version' => '0.2.0',
 26+ 'version' => '0.2.2',
2727 'url' => "http://www.mediawiki.org/wiki/Extension:Favorites",
2828 );
29 -
30 -
3129
32 -
 30+global $wgUseIconFavorite;
3331 $dir = dirname(__FILE__) . '/';
3432 $wgExtensionMessagesFiles['Favorites'] = $dir . 'favorites.i18n.php';
3533 $wgAutoloadClasses['Favorites'] = $dir . 'Favorites_body.php';
@@ -52,6 +50,11 @@
5351 $wgHooks['SkinTemplateNavigation'][] = 'fnNavUrls'; // For Vector
5452 $wgHooks['SkinTemplateTabs'][] = 'fnNavTabs'; // For other skins
5553
 54+if ($wgUseIconFavorite){
 55+ //add CSS - only needed for icon display
 56+ $wgHooks['BeforePageDisplay'][] = 'fnAddCss';
 57+}
 58+
5659 //add or remove
5760 $wgHooks['UnknownAction'][] = 'fnAction';
5861
@@ -59,10 +62,7 @@
6063 $wgHooks['TitleMoveComplete'][] = 'fnHookMoveToFav';
6164 $wgHooks['ArticleDeleteComplete'][] = 'fnHookDeleteFav';
6265
63 -//add CSS
64 -$wgHooks['BeforePageDisplay'][] = 'fnAddCss';
6566
66 -
6767 function fnAction ($action, $article) {
6868 $title = new Title();
6969 $favArticle = new FavArticle($title);
@@ -107,7 +107,7 @@
108108
109109 function fnAddCss (&$out) {
110110 global $wgScriptPath;
111 - $out->addStyle($wgScriptPath. '/extensions/favorites/favorites.css');
 111+ $out->addStyle($wgScriptPath. '/extensions/Favorites/favorites.css');
112112 return true;
113113 }
114114

Status & tagging log