Index: trunk/extensions/WebFonts/WebFonts.hooks.php |
— | — | @@ -8,9 +8,9 @@ |
9 | 9 | |
10 | 10 | // WebFonts hooks |
11 | 11 | class WebFontsHooks { |
12 | | - |
13 | 12 | public static function addModules( $out, $skin ) { |
14 | 13 | global $wgUser; |
| 14 | + |
15 | 15 | if ( !$wgUser->getOption( 'webfontsDisable' ) ) { |
16 | 16 | $out->addModules( 'webfonts' ); |
17 | 17 | } |
— | — | @@ -25,8 +25,7 @@ |
26 | 26 | 'label-message' => 'webfonts-disable-preference', // a system message |
27 | 27 | 'section' => 'rendering/advancedrendering', // under 'Advanced options' section of 'Editing' tab |
28 | 28 | ); |
| 29 | + |
29 | 30 | return true; |
30 | 31 | } |
31 | | - |
32 | 32 | } |
33 | | - |
Index: trunk/extensions/WebFonts/css/webfonts.css |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | li#pt-webfont{ |
3 | 3 | background: url(images/font-icon.png) no-repeat scroll left top transparent; |
4 | | - padding-left: 15px !important; |
| 4 | + padding-left: 15px !important; |
5 | 5 | } |
6 | 6 | |
7 | 7 | div#webfonts-menu{ |
Index: trunk/extensions/WebFonts/js/webfonts.js |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | |
4 | 4 | $.webfonts = { |
5 | 5 | |
6 | | - |
| 6 | + |
7 | 7 | oldconfig: false, |
8 | 8 | config : $.webfonts.config, |
9 | 9 | /* Version number */ |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | else{ |
43 | 43 | $.webfonts.scale(1); |
44 | 44 | } |
45 | | - |
| 45 | + |
46 | 46 | if ( 'normalization' in config ) { |
47 | 47 | $(document).ready(function() { |
48 | 48 | $.webfonts.normalize(config.normalization); |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | */ |
73 | 73 | scale : function (percentage){ |
74 | 74 | //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 |
76 | 76 | //uniform scaling. |
77 | 77 | }, |
78 | 78 | |
— | — | @@ -100,7 +100,7 @@ |
101 | 101 | }); |
102 | 102 | }); |
103 | 103 | }, |
104 | | - |
| 104 | + |
105 | 105 | /* |
106 | 106 | * Construct the css required for the fontfamily, inject it to the head of the body |
107 | 107 | * so that it gets loaded. |
— | — | @@ -129,13 +129,13 @@ |
130 | 130 | } |
131 | 131 | |
132 | 132 | styleString += "\tfont-weight: normal;\n}\n</style>\n"; |
133 | | - |
| 133 | + |
134 | 134 | //inject the css to the head of the page. |
135 | 135 | $(styleString).appendTo("head" ); |
136 | 136 | |
137 | 137 | }, |
138 | 138 | /** |
139 | | - * Setup the font selection menu. |
| 139 | + * Setup the font selection menu. |
140 | 140 | * It also apply the font from cookie, if any. |
141 | 141 | */ |
142 | 142 | setup: function() { |
— | — | @@ -166,13 +166,13 @@ |
167 | 167 | //mark it as checked |
168 | 168 | $('#webfont-'+cookie_font).attr('checked', 'checked'); |
169 | 169 | } |
170 | | - |
| 170 | + |
171 | 171 | //if there are tags with font-family style definition, get a list of fonts to be loaded |
172 | 172 | var fontFamilies = []; |
173 | 173 | $('body').find('*[style]').each(function(index){ |
174 | 174 | if( this.style.fontFamily){ |
175 | 175 | var fontFamilyItems = this.style.fontFamily.split(","); |
176 | | - $.each(fontFamilyItems, function(index, value) { |
| 176 | + $.each(fontFamilyItems, function(index, value) { |
177 | 177 | fontFamilies.push(value ); |
178 | 178 | }); |
179 | 179 | } |
— | — | @@ -180,7 +180,7 @@ |
181 | 181 | //get unique list |
182 | 182 | fontFamilies = $.unique(fontFamilies); |
183 | 183 | //load css for each of the item in fontfamily list |
184 | | - $.each(fontFamilies, function(index, fontFamily) { |
| 184 | + $.each(fontFamilies, function(index, fontFamily) { |
185 | 185 | //remove the ' characters if any. |
186 | 186 | fontFamily = fontFamily.replace(/'/g,''); |
187 | 187 | if ( fontFamily in $.webfonts.config.fonts ) { |
— | — | @@ -199,16 +199,16 @@ |
200 | 200 | .attr("name","font") |
201 | 201 | .attr("id","webfont-"+config[scheme]) |
202 | 202 | .attr("value",config[scheme] ); |
203 | | - |
| 203 | + |
204 | 204 | var $fontLabel = $( '<label />' ) |
205 | 205 | .attr("for","webfont-"+config[scheme]) |
206 | 206 | .append( $fontLink ) |
207 | 207 | .append( config[scheme] ); |
208 | | - |
| 208 | + |
209 | 209 | var $fontMenuItem = $( '<li />' ) |
210 | 210 | .val( config[scheme] ) |
211 | 211 | .append( $fontLabel ); |
212 | | - |
| 212 | + |
213 | 213 | haveSchemes = true; |
214 | 214 | //some closure trick :) |
215 | 215 | (function (font) { |
— | — | @@ -218,7 +218,7 @@ |
219 | 219 | }) (config[scheme]); |
220 | 220 | |
221 | 221 | $fontsMenu.append($fontMenuItem); |
222 | | - |
| 222 | + |
223 | 223 | } |
224 | 224 | var $resetLink = $( '<input />' ) |
225 | 225 | .attr("type","radio") |
— | — | @@ -228,16 +228,16 @@ |
229 | 229 | .click( function( event ) { |
230 | 230 | $.webfonts.set( 'none'); |
231 | 231 | }); |
232 | | - |
| 232 | + |
233 | 233 | var $resetLabel = $( '<label />' ) |
234 | 234 | .attr("for","webfont-none") |
235 | 235 | .append( $resetLink ) |
236 | 236 | .append( mw.msg("webfonts-reset")); |
237 | | - |
| 237 | + |
238 | 238 | var $resetLinkItem = $( '<li />' ) |
239 | 239 | .val( 'none') |
240 | 240 | .append( $resetLabel ); |
241 | | - |
| 241 | + |
242 | 242 | $fontsMenu.append($resetLinkItem); |
243 | 243 | if ( !haveSchemes ) { |
244 | 244 | // No schemes available, don't show the tool |
— | — | @@ -264,7 +264,7 @@ |
265 | 265 | } |
266 | 266 | else{ |
267 | 267 | $($('#p-personal ul')[0]).prepend( $li ); |
268 | | - } |
| 268 | + } |
269 | 269 | } |
270 | 270 | }; |
271 | 271 | |
Index: trunk/extensions/WebFonts/WebFonts.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | $wgResourceModules['webfonts'] = array( |
43 | 43 | 'scripts' => 'js/webfonts.js', |
44 | 44 | 'styles' => 'css/webfonts.css', |
45 | | - 'localBasePath' => dirname( __FILE__ ), |
| 45 | + 'localBasePath' => $dir, |
46 | 46 | 'remoteExtPath' => 'WebFonts', |
47 | 47 | 'messages' => array( 'webfonts-load', 'webfonts-reset' ), |
48 | 48 | 'dependencies' => 'webfonts.fontlist', |
— | — | @@ -49,6 +49,6 @@ |
50 | 50 | |
51 | 51 | $wgResourceModules['webfonts.fontlist'] = array( |
52 | 52 | 'scripts' => 'js/webfonts.fontlist.js', |
53 | | - 'localBasePath' => dirname( __FILE__ ), |
| 53 | + 'localBasePath' => $dir, |
54 | 54 | 'remoteExtPath' => 'WebFonts', |
55 | 55 | ); |