r109513 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109512‎ | r109513 | r109514 >
Date:10:27, 19 January 2012
Author:nikerabbit
Status:ok
Tags:i18nreview 
Comment:
Split the blacklist out of setup to different function. Some JSHint complaints fixed
Modified paths:
  • /trunk/extensions/WebFonts/resources/ext.webfonts.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WebFonts/resources/ext.webfonts.js
@@ -4,7 +4,7 @@
55 if ( typeof font !== 'string' ) {
66 return font;
77 }
8 - return 'webfont-' + font.toLowerCase().replace(/[_ ]/g, '-' ).replace(/[^-a-z]/g, '' );
 8+ return 'webfont-' + font.toLowerCase().replace(/[_ ]/g, '-' ).replace(/[^\-a-z]/g, '' );
99 }
1010
1111 mw.webfonts = {
@@ -168,13 +168,11 @@
169169
170170 return true;
171171 },
172 -
 172+
173173 /**
174 - * Setup the font selection menu.
175 - * It also apply the font from cookie, if any.
 174+ * Checks whether the browser is supported
176175 */
177 - setup: function() {
178 - // Blacklist some browsers that are known to have issues with font rendering
 176+ isBrowserSupported: function() {
179177 if ( navigator.appName === 'Microsoft Internet Explorer' ) {
180178 var ua = navigator.userAgent;
181179 if ( /MSIE 6/i.test( ua ) ) {
@@ -185,7 +183,19 @@
186184 return false;
187185 }
188186 }
 187+ return true;
 188+ },
189189
 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+
190200 var fonts = [],
191201 languages = mw.webfonts.config.languages,
192202 requested = [ mw.config.get( 'wgUserVariant' ), mw.config.get( 'wgContentLanguage' ),

Status & tagging log