r105989 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105988‎ | r105989 | r105990 >
Date:05:39, 13 December 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/WebFonts/resources/ext.webfonts.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/WebFonts/resources/ext.webfonts.js
@@ -218,16 +218,20 @@
219219 */
220220 loadFontsForLangAttr: function() {
221221 var languages = mw.webfonts.config.languages;
 222+ var requested = [mw.config.get( 'wgUserVariant' ), mw.config.get( 'wgContentLanguage' ), mw.config.get( 'wgUserLanguage' )];
222223 // If there are tags with lang attribute,
223224 $( 'body' ).find( '*[lang]' ).each( function( index ) {
224 - // .. check the availability of font, add a font-family style if it does not have any
225 - if( languages[this.lang] && ( !this.style.fontFamily || this.style.fontFamily === 'none' ) ) {
226 - fontFamily = languages[this.lang][0];
227 - mw.webfonts.addFont( fontFamily );
228 - $(this).css( 'font-family', fontFamily ).addClass( 'webfonts-lang-attr' );
 225+ // If the lang attribute value is same as one of
 226+ // contentLang,useLang, variant, no need to do this.
 227+ if( $.inArray( this.lang , requested ) === -1 ) {
 228+ // check the availability of font, add a font-family style if it does not have any
 229+ if( languages[this.lang] && ( !this.style.fontFamily || this.style.fontFamily === 'none' ) ) {
 230+ fontFamily = languages[this.lang][0];
 231+ mw.webfonts.addFont( fontFamily );
 232+ $(this).css( 'font-family', fontFamily ).addClass( 'webfonts-lang-attr' );
 233+ }
229234 }
230235 });
231 -
232236 },
233237
234238 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105980If an element is having lang attribute value same as page language(contentLan...santhosh04:46, 13 December 2011

Status & tagging log