Index: trunk/extensions/WebFonts/WebFonts.hooks.php |
— | — | @@ -22,21 +22,6 @@ |
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | | - * MakeGlobalVariablesScript hook handler. |
27 | | - */ |
28 | | - public static function addVariables( &$vars, $out ) { |
29 | | - global $wgWebFontsEnabledByDefault; |
30 | | - |
31 | | - if ( $out->getUser()->isAnon() ) { |
32 | | - // If user enabled webfonts from preference page, |
33 | | - // wgWebFontsEnabledByDefault is overridden by that. |
34 | | - $vars['wgWebFontsEnabledByDefault'] = $wgWebFontsEnabledByDefault; |
35 | | - } |
36 | | - |
37 | | - return true; |
38 | | - } |
39 | | - |
40 | | - /** |
41 | 26 | * GetPreferences hook handler. |
42 | 27 | */ |
43 | 28 | public static function addPreference( $user, &$preferences ) { |
— | — | @@ -50,4 +35,14 @@ |
51 | 36 | |
52 | 37 | return true; |
53 | 38 | } |
| 39 | + |
| 40 | + /** |
| 41 | + * UserGetDefaultOptions hook handler. |
| 42 | + */ |
| 43 | + public static function addDefaultOptions( &$defaultOptions ) { |
| 44 | + global $wgWebFontsEnabledByDefault; |
| 45 | + // By default, the preference page option to enable webfonts is set to wgWebFontsEnabledByDefault value. |
| 46 | + $defaultOptions['webfontsEnable'] = $wgWebFontsEnabledByDefault; |
| 47 | + return true; |
| 48 | + } |
54 | 49 | } |
Index: trunk/extensions/WebFonts/js/webfonts.js |
— | — | @@ -162,11 +162,7 @@ |
163 | 163 | var config = []; |
164 | 164 | var languages = $.webfonts.config.languages; |
165 | 165 | var requested = [mw.config.get( 'wgUserVariant' ), mw.config.get( 'wgContentLanguage' ), mw.config.get( 'wgUserLanguage' )]; |
166 | | - if ( mw.config.get( 'wgWebFontsEnabledByDefault' ) == false ) { |
167 | | - // Webfonts are not enabled by default. Not setting up. |
168 | | - // This is applicable only for anonymous users. |
169 | | - return false; |
170 | | - } |
| 166 | + |
171 | 167 | for (var i = 0; i < requested.length; i++) { |
172 | 168 | if (requested[i] in languages) { |
173 | 169 | var fonts = languages[requested[i]]; |
Index: trunk/extensions/WebFonts/WebFonts.php |
— | — | @@ -36,13 +36,10 @@ |
37 | 37 | |
38 | 38 | $wgHooks['BeforePageDisplay'][] = 'WebFontsHooks::addModules'; |
39 | 39 | $wgHooks['GetPreferences'][] = 'WebFontsHooks::addPreference'; |
40 | | -$wgHooks['MakeGlobalVariablesScript'][] = 'WebFontsHooks::addVariables'; |
| 40 | +$wgHooks['UserGetDefaultOptions'][] = 'WebFontsHooks::addDefaultOptions'; |
41 | 41 | |
42 | 42 | $wgWebFontsEnabledByDefault = true; |
43 | 43 | |
44 | | -// By default, the preference page option to enable webfonts is set to true. |
45 | | -$wgDefaultUserOptions['webfontsEnable'] = true; |
46 | | - |
47 | 44 | $wgResourceModules['webfonts'] = array( |
48 | 45 | 'scripts' => 'js/webfonts.js', |
49 | 46 | 'styles' => 'css/webfonts.css', |