Index: trunk/extensions/WebFonts/js/webfonts.js |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | $.webfonts = { |
12 | 12 | |
13 | 13 | oldconfig: false, |
14 | | - config : $.webfonts.config, |
| 14 | + config: $.webfonts.config, |
15 | 15 | /* Version number */ |
16 | 16 | version: "0.1.2", |
17 | 17 | fonts : [], |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | * keep track of added fonts. |
149 | 149 | * @param fontFamilyName The fontfamily name |
150 | 150 | */ |
151 | | - addFont : function( fontFamilyName ) { |
| 151 | + addFont: function( fontFamilyName ) { |
152 | 152 | // avoid duplication |
153 | 153 | if ( $.inArray( fontFamilyName, $.webfonts.fonts ) < 0 ){ |
154 | 154 | // check whether the requested font is available. |
— | — | @@ -165,8 +165,7 @@ |
166 | 166 | setup: function() { |
167 | 167 | var config = []; |
168 | 168 | var languages = $.webfonts.config.languages; |
169 | | - var userVariant = (typeof wgUserVariant != 'undefined' )? wgUserVariant : null; |
170 | | - var requested = [userVariant, wgContentLanguage, wgUserLanguage]; |
| 169 | + var requested = [mw.config.get( 'wgUserVariant' ), mw.config.get( 'wgContentLanguage' ), mw.config.get( 'wgUserLanguage' )]; |
171 | 170 | if ( mw.config.get( 'wgWebFontsEnabledByDefault' ) == false ) { |
172 | 171 | // Webfonts are not enabled by default. Not setting up. |
173 | 172 | // This is applicable only for anonymous users. |
Index: trunk/extensions/WebFonts/WebFonts.php |
— | — | @@ -27,6 +27,7 @@ |
28 | 28 | ); |
29 | 29 | |
30 | 30 | $dir = dirname( __FILE__ ); |
| 31 | + |
31 | 32 | // Internationalization |
32 | 33 | $wgExtensionMessagesFiles['WebFonts'] = "$dir/WebFonts.i18n.php"; |
33 | 34 | |
Index: trunk/extensions/WebFonts/WebFonts.hooks.php |
— | — | @@ -8,6 +8,10 @@ |
9 | 9 | |
10 | 10 | // WebFonts hooks |
11 | 11 | class WebFontsHooks { |
| 12 | + |
| 13 | + /** |
| 14 | + * BeforePageDisplay hook handler. |
| 15 | + */ |
12 | 16 | public static function addModules( $out, $skin ) { |
13 | 17 | global $wgUser; |
14 | 18 | |
— | — | @@ -15,10 +19,13 @@ |
16 | 20 | $out->addModules( 'webfonts' ); |
17 | 21 | } |
18 | 22 | |
19 | | - return true; // Hooks must return value |
| 23 | + return true; |
20 | 24 | } |
21 | 25 | |
22 | | - public static function addVariables( &$vars ) { |
| 26 | + /** |
| 27 | + * MakeGlobalVariablesScript hook handler. |
| 28 | + */ |
| 29 | + public static function addVariables( &$vars, $out ) { |
23 | 30 | global $wgWebFontsEnabledByDefault, $wgUser; |
24 | 31 | |
25 | 32 | if ( $wgUser->isAnon() ) { |
— | — | @@ -29,7 +36,10 @@ |
30 | 37 | |
31 | 38 | return true; |
32 | 39 | } |
33 | | - |
| 40 | + |
| 41 | + /** |
| 42 | + * GetPreferences hook handler. |
| 43 | + */ |
34 | 44 | public static function addPreference( $user, &$preferences ) { |
35 | 45 | global $wgUser; |
36 | 46 | // A checkbox in preferences to enable WebFonts |