Log tofu detection event

This only works if webfonts enabled (the checkbox is checked).

Change-Id: Ibbedc6a34dacb983f156d8a33afa5ab625e32f5f
This commit is contained in:
Amir E. Aharoni
2014-02-17 23:12:02 +02:00
parent 4f27c6769b
commit 261542d738
4 changed files with 48 additions and 11 deletions

View File

@@ -168,9 +168,15 @@
detectTofu( $.uls.data.getAutonym( language ) );
if ( tofu ) {
mw.log( 'tofu detected for ' + language );
// Cache the languages with tofu
tofuLanguages[language] = true;
// Log the tofu detection only once per page per language
if ( !tofuLanguages[language] ) {
mw.log( 'tofu detected for ' + language );
mw.hook( 'mw.uls.webfonts.tofudetected' ).fire( language );
// Cache the languages with tofu
tofuLanguages[language] = true;
}
font = autonym ? 'Autonym' : defaultFont;
} else {
// No tofu and no font preference. Use system font.