r97808 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97807‎ | r97808 | r97809 >
Date:11:22, 22 September 2011
Author:santhosh
Status:ok
Tags:
Comment:
Add support for loading the fonts based on lang attribute(If available and if the tag does not define its own font-family). Ref bug 29000.
Modified paths:
  • /trunk/extensions/WebFonts/js/webfonts.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WebFonts/js/webfonts.js
@@ -183,6 +183,20 @@
184184 });
185185 }
186186 });
 187+
 188+ //if there are tags with lang attribute,
 189+ $('body').find('*[lang]').each(function(index) {
 190+ //check the availability of font.
 191+ if(languages[this.lang]){
 192+ //add a font-family style if it does not have any
 193+ if( !this.style.fontFamily) {
 194+ //use the default font, ie the first one.
 195+ fontFamilies.push(languages[this.lang][0]);
 196+ $(this).css('font-family', languages[this.lang][0]);
 197+ }
 198+ }
 199+ });
 200+
187201 //get unique list
188202 fontFamilies = $.unique(fontFamilies);
189203 //load css for each of the item in fontfamily list

Status & tagging log