Log font-change event

Change-Id: I093e27d74d047a639082a5da6442944f590c67dc
This commit is contained in:
Santhosh Thottingal
2013-08-15 11:31:02 +05:30
committed by Nikerabbit
parent 80715de3b2
commit 44bd73325a
2 changed files with 42 additions and 0 deletions

View File

@@ -582,6 +582,21 @@
// Save the preferences
mw.webfonts.preferences.save( function ( result ) {
var newFonts = mw.webfonts.preferences.registry.fonts || {},
oldFonts = displaySettings.savedRegistry.registry.fonts || {};
if ( newFonts[displaySettings.uiLanguage] !== oldFonts[displaySettings.uiLanguage] ) {
mw.hook( 'mw.uls.font.change' ).fire(
'interface', displaySettings.uiLanguage, newFonts[displaySettings.uiLanguage]
);
}
if ( newFonts[displaySettings.contentLanguage] !== oldFonts[displaySettings.contentLanguage] ) {
mw.hook( 'mw.uls.font.change' ).fire(
'content', displaySettings.contentLanguage, newFonts[displaySettings.contentLanguage]
);
}
// closure for not losing the scope
displaySettings.onSave( result );
displaySettings.dirty = false;