r95850 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95849‎ | r95850 | r95851 >
Date:10:39, 31 August 2011
Author:siebrand
Status:ok
Tags:
Comment:
stylize.php.
Use $dir instead of multiple times dirname( __FILE__ ).
Various whitespace and indentation updates.
Modified paths:
  • /trunk/extensions/WebFonts/WebFonts.hooks.php (modified) (history)
  • /trunk/extensions/WebFonts/WebFonts.php (modified) (history)
  • /trunk/extensions/WebFonts/css/webfonts.css (modified) (history)
  • /trunk/extensions/WebFonts/js/webfonts.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WebFonts/WebFonts.hooks.php
@@ -8,9 +8,9 @@
99
1010 // WebFonts hooks
1111 class WebFontsHooks {
12 -
1312 public static function addModules( $out, $skin ) {
1413 global $wgUser;
 14+
1515 if ( !$wgUser->getOption( 'webfontsDisable' ) ) {
1616 $out->addModules( 'webfonts' );
1717 }
@@ -25,8 +25,7 @@
2626 'label-message' => 'webfonts-disable-preference', // a system message
2727 'section' => 'rendering/advancedrendering', // under 'Advanced options' section of 'Editing' tab
2828 );
 29+
2930 return true;
3031 }
31 -
3232 }
33 -
Index: trunk/extensions/WebFonts/css/webfonts.css
@@ -1,6 +1,6 @@
22 li#pt-webfont{
33 background: url(images/font-icon.png) no-repeat scroll left top transparent;
4 - padding-left: 15px !important;
 4+ padding-left: 15px !important;
55 }
66
77 div#webfonts-menu{
Index: trunk/extensions/WebFonts/js/webfonts.js
@@ -2,7 +2,7 @@
33
44 $.webfonts = {
55
6 -
 6+
77 oldconfig: false,
88 config : $.webfonts.config,
99 /* Version number */
@@ -41,7 +41,7 @@
4242 else{
4343 $.webfonts.scale(1);
4444 }
45 -
 45+
4646 if ( 'normalization' in config ) {
4747 $(document).ready(function() {
4848 $.webfonts.normalize(config.normalization);
@@ -71,7 +71,7 @@
7272 */
7373 scale : function (percentage){
7474 //TODO: Not Implemented. Need to find a better way to emulate fontconfig font-scale feature.
75 - //Changing the font-size of few selectors does not work properly and not able to achieve
 75+ //Changing the font-size of few selectors does not work properly and not able to achieve
7676 //uniform scaling.
7777 },
7878
@@ -100,7 +100,7 @@
101101 });
102102 });
103103 },
104 -
 104+
105105 /*
106106 * Construct the css required for the fontfamily, inject it to the head of the body
107107 * so that it gets loaded.
@@ -129,13 +129,13 @@
130130 }
131131
132132 styleString += "\tfont-weight: normal;\n}\n</style>\n";
133 -
 133+
134134 //inject the css to the head of the page.
135135 $(styleString).appendTo("head" );
136136
137137 },
138138 /**
139 - * Setup the font selection menu.
 139+ * Setup the font selection menu.
140140 * It also apply the font from cookie, if any.
141141 */
142142 setup: function() {
@@ -166,13 +166,13 @@
167167 //mark it as checked
168168 $('#webfont-'+cookie_font).attr('checked', 'checked');
169169 }
170 -
 170+
171171 //if there are tags with font-family style definition, get a list of fonts to be loaded
172172 var fontFamilies = [];
173173 $('body').find('*[style]').each(function(index){
174174 if( this.style.fontFamily){
175175 var fontFamilyItems = this.style.fontFamily.split(",");
176 - $.each(fontFamilyItems, function(index, value) {
 176+ $.each(fontFamilyItems, function(index, value) {
177177 fontFamilies.push(value );
178178 });
179179 }
@@ -180,7 +180,7 @@
181181 //get unique list
182182 fontFamilies = $.unique(fontFamilies);
183183 //load css for each of the item in fontfamily list
184 - $.each(fontFamilies, function(index, fontFamily) {
 184+ $.each(fontFamilies, function(index, fontFamily) {
185185 //remove the ' characters if any.
186186 fontFamily = fontFamily.replace(/'/g,'');
187187 if ( fontFamily in $.webfonts.config.fonts ) {
@@ -199,16 +199,16 @@
200200 .attr("name","font")
201201 .attr("id","webfont-"+config[scheme])
202202 .attr("value",config[scheme] );
203 -
 203+
204204 var $fontLabel = $( '<label />' )
205205 .attr("for","webfont-"+config[scheme])
206206 .append( $fontLink )
207207 .append( config[scheme] );
208 -
 208+
209209 var $fontMenuItem = $( '<li />' )
210210 .val( config[scheme] )
211211 .append( $fontLabel );
212 -
 212+
213213 haveSchemes = true;
214214 //some closure trick :)
215215 (function (font) {
@@ -218,7 +218,7 @@
219219 }) (config[scheme]);
220220
221221 $fontsMenu.append($fontMenuItem);
222 -
 222+
223223 }
224224 var $resetLink = $( '<input />' )
225225 .attr("type","radio")
@@ -228,16 +228,16 @@
229229 .click( function( event ) {
230230 $.webfonts.set( 'none');
231231 });
232 -
 232+
233233 var $resetLabel = $( '<label />' )
234234 .attr("for","webfont-none")
235235 .append( $resetLink )
236236 .append( mw.msg("webfonts-reset"));
237 -
 237+
238238 var $resetLinkItem = $( '<li />' )
239239 .val( 'none')
240240 .append( $resetLabel );
241 -
 241+
242242 $fontsMenu.append($resetLinkItem);
243243 if ( !haveSchemes ) {
244244 // No schemes available, don't show the tool
@@ -264,7 +264,7 @@
265265 }
266266 else{
267267 $($('#p-personal ul')[0]).prepend( $li );
268 - }
 268+ }
269269 }
270270 };
271271
Index: trunk/extensions/WebFonts/WebFonts.php
@@ -41,7 +41,7 @@
4242 $wgResourceModules['webfonts'] = array(
4343 'scripts' => 'js/webfonts.js',
4444 'styles' => 'css/webfonts.css',
45 - 'localBasePath' => dirname( __FILE__ ),
 45+ 'localBasePath' => $dir,
4646 'remoteExtPath' => 'WebFonts',
4747 'messages' => array( 'webfonts-load', 'webfonts-reset' ),
4848 'dependencies' => 'webfonts.fontlist',
@@ -49,6 +49,6 @@
5050
5151 $wgResourceModules['webfonts.fontlist'] = array(
5252 'scripts' => 'js/webfonts.fontlist.js',
53 - 'localBasePath' => dirname( __FILE__ ),
 53+ 'localBasePath' => $dir,
5454 'remoteExtPath' => 'WebFonts',
5555 );

Status & tagging log