Index: trunk/extensions/WebFonts/resources/ext.webfonts.js |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | if ( typeof font !== 'string' ) { |
6 | 6 | return font; |
7 | 7 | } |
8 | | - return 'webfont-' + font.toLowerCase().replace(/[_ ]/g, '-' ).replace(/[^-a-z]/g, '' ); |
| 8 | + return 'webfont-' + font.toLowerCase().replace(/[_ ]/g, '-' ).replace(/[^\-a-z]/g, '' ); |
9 | 9 | } |
10 | 10 | |
11 | 11 | mw.webfonts = { |
— | — | @@ -168,13 +168,11 @@ |
169 | 169 | |
170 | 170 | return true; |
171 | 171 | }, |
172 | | - |
| 172 | + |
173 | 173 | /** |
174 | | - * Setup the font selection menu. |
175 | | - * It also apply the font from cookie, if any. |
| 174 | + * Checks whether the browser is supported |
176 | 175 | */ |
177 | | - setup: function() { |
178 | | - // Blacklist some browsers that are known to have issues with font rendering |
| 176 | + isBrowserSupported: function() { |
179 | 177 | if ( navigator.appName === 'Microsoft Internet Explorer' ) { |
180 | 178 | var ua = navigator.userAgent; |
181 | 179 | if ( /MSIE 6/i.test( ua ) ) { |
— | — | @@ -185,7 +183,19 @@ |
186 | 184 | return false; |
187 | 185 | } |
188 | 186 | } |
| 187 | + return true; |
| 188 | + }, |
189 | 189 | |
| 190 | + /** |
| 191 | + * Setup the font selection menu. |
| 192 | + * It also apply the font from cookie, if any. |
| 193 | + */ |
| 194 | + setup: function() { |
| 195 | + // Some browsers are known to have issues with font rendering |
| 196 | + if ( !mw.webfonts.isBrowserSupported ) { |
| 197 | + return false; |
| 198 | + } |
| 199 | + |
190 | 200 | var fonts = [], |
191 | 201 | languages = mw.webfonts.config.languages, |
192 | 202 | requested = [ mw.config.get( 'wgUserVariant' ), mw.config.get( 'wgContentLanguage' ), |