http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95850
Revision: 95850
Author: siebrand
Date: 2011-08-31 10:39:07 +0000 (Wed, 31 Aug 2011)
Log Message:
-----------
stylize.php.
Use $dir instead of multiple times dirname( __FILE__ ).
Various whitespace and indentation updates.
Modified Paths:
--------------
trunk/extensions/WebFonts/WebFonts.hooks.php
trunk/extensions/WebFonts/WebFonts.php
trunk/extensions/WebFonts/css/webfonts.css
trunk/extensions/WebFonts/js/webfonts.js
Modified: trunk/extensions/WebFonts/WebFonts.hooks.php
===================================================================
--- trunk/extensions/WebFonts/WebFonts.hooks.php 2011-08-31 10:38:42 UTC
(rev 95849)
+++ trunk/extensions/WebFonts/WebFonts.hooks.php 2011-08-31 10:39:07 UTC
(rev 95850)
@@ -8,9 +8,9 @@
// WebFonts hooks
class WebFontsHooks {
-
public static function addModules( $out, $skin ) {
global $wgUser;
+
if ( !$wgUser->getOption( 'webfontsDisable' ) ) {
$out->addModules( 'webfonts' );
}
@@ -25,8 +25,7 @@
'label-message' => 'webfonts-disable-preference', // a
system message
'section' => 'rendering/advancedrendering', // under
'Advanced options' section of 'Editing' tab
);
+
return true;
}
-
}
-
Modified: trunk/extensions/WebFonts/WebFonts.php
===================================================================
--- trunk/extensions/WebFonts/WebFonts.php 2011-08-31 10:38:42 UTC (rev
95849)
+++ trunk/extensions/WebFonts/WebFonts.php 2011-08-31 10:39:07 UTC (rev
95850)
@@ -41,7 +41,7 @@
$wgResourceModules['webfonts'] = array(
'scripts' => 'js/webfonts.js',
'styles' => 'css/webfonts.css',
- 'localBasePath' => dirname( __FILE__ ),
+ 'localBasePath' => $dir,
'remoteExtPath' => 'WebFonts',
'messages' => array( 'webfonts-load', 'webfonts-reset' ),
'dependencies' => 'webfonts.fontlist',
@@ -49,6 +49,6 @@
$wgResourceModules['webfonts.fontlist'] = array(
'scripts' => 'js/webfonts.fontlist.js',
- 'localBasePath' => dirname( __FILE__ ),
+ 'localBasePath' => $dir,
'remoteExtPath' => 'WebFonts',
);
Modified: trunk/extensions/WebFonts/css/webfonts.css
===================================================================
--- trunk/extensions/WebFonts/css/webfonts.css 2011-08-31 10:38:42 UTC (rev
95849)
+++ trunk/extensions/WebFonts/css/webfonts.css 2011-08-31 10:39:07 UTC (rev
95850)
@@ -1,6 +1,6 @@
li#pt-webfont{
background: url(images/font-icon.png) no-repeat scroll left top
transparent;
- padding-left: 15px !important;
+ padding-left: 15px !important;
}
div#webfonts-menu{
Modified: trunk/extensions/WebFonts/js/webfonts.js
===================================================================
--- trunk/extensions/WebFonts/js/webfonts.js 2011-08-31 10:38:42 UTC (rev
95849)
+++ trunk/extensions/WebFonts/js/webfonts.js 2011-08-31 10:39:07 UTC (rev
95850)
@@ -2,7 +2,7 @@
$.webfonts = {
-
+
oldconfig: false,
config : $.webfonts.config,
/* Version number */
@@ -41,7 +41,7 @@
else{
$.webfonts.scale(1);
}
-
+
if ( 'normalization' in config ) {
$(document).ready(function() {
$.webfonts.normalize(config.normalization);
@@ -71,7 +71,7 @@
*/
scale : function (percentage){
//TODO: Not Implemented. Need to find a better way to
emulate fontconfig font-scale feature.
- //Changing the font-size of few selectors does not work
properly and not able to achieve
+ //Changing the font-size of few selectors does not work
properly and not able to achieve
//uniform scaling.
},
@@ -100,7 +100,7 @@
});
});
},
-
+
/*
* Construct the css required for the fontfamily, inject it to
the head of the body
* so that it gets loaded.
@@ -129,13 +129,13 @@
}
styleString += "\tfont-weight: normal;\n}\n</style>\n";
-
+
//inject the css to the head of the page.
$(styleString).appendTo("head" );
},
/**
- * Setup the font selection menu.
+ * Setup the font selection menu.
* It also apply the font from cookie, if any.
*/
setup: function() {
@@ -166,13 +166,13 @@
//mark it as checked
$('#webfont-'+cookie_font).attr('checked',
'checked');
}
-
+
//if there are tags with font-family style definition,
get a list of fonts to be loaded
var fontFamilies = [];
$('body').find('*[style]').each(function(index){
if( this.style.fontFamily){
var fontFamilyItems =
this.style.fontFamily.split(",");
- $.each(fontFamilyItems, function(index,
value) {
+ $.each(fontFamilyItems, function(index,
value) {
fontFamilies.push(value );
});
}
@@ -180,7 +180,7 @@
//get unique list
fontFamilies = $.unique(fontFamilies);
//load css for each of the item in fontfamily list
- $.each(fontFamilies, function(index, fontFamily) {
+ $.each(fontFamilies, function(index, fontFamily) {
//remove the ' characters if any.
fontFamily = fontFamily.replace(/'/g,'');
if ( fontFamily in $.webfonts.config.fonts ) {
@@ -199,16 +199,16 @@
.attr("name","font")
.attr("id","webfont-"+config[scheme])
.attr("value",config[scheme] );
-
+
var $fontLabel = $( '<label />' )
.attr("for","webfont-"+config[scheme])
.append( $fontLink )
.append( config[scheme] );
-
+
var $fontMenuItem = $( '<li />' )
.val( config[scheme] )
.append( $fontLabel );
-
+
haveSchemes = true;
//some closure trick :)
(function (font) {
@@ -218,7 +218,7 @@
}) (config[scheme]);
$fontsMenu.append($fontMenuItem);
-
+
}
var $resetLink = $( '<input />' )
.attr("type","radio")
@@ -228,16 +228,16 @@
.click( function( event ) {
$.webfonts.set( 'none');
});
-
+
var $resetLabel = $( '<label />' )
.attr("for","webfont-none")
.append( $resetLink )
.append( mw.msg("webfonts-reset"));
-
+
var $resetLinkItem = $( '<li />' )
.val( 'none')
.append( $resetLabel );
-
+
$fontsMenu.append($resetLinkItem);
if ( !haveSchemes ) {
// No schemes available, don't show the
tool
@@ -264,7 +264,7 @@
}
else{
$($('#p-personal ul')[0]).prepend( $li );
- }
+ }
}
};
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs