Fix JavaScript error on pages without headings
Error was caused because .css( 'font-family' ) returns undefined for elements which do not exist. Merged two blocks both extending the default settings. Bug: 67676 Change-Id: Ic33f3934166f4feb6dd088ca0d14e249fcf237a3
This commit is contained in:
@@ -129,10 +129,6 @@
|
|||||||
$.extend( $.fn.webfonts.defaults, {
|
$.extend( $.fn.webfonts.defaults, {
|
||||||
repository: mediawikiFontRepository,
|
repository: mediawikiFontRepository,
|
||||||
fontStack: $( 'body' ).css( 'font-family' ).split( /, /g ),
|
fontStack: $( 'body' ).css( 'font-family' ).split( /, /g ),
|
||||||
exclude: mw.config.get( 'wgULSNoWebfontsSelectors' ).join( ', ' )
|
|
||||||
} );
|
|
||||||
|
|
||||||
$.fn.webfonts.defaults = $.extend( $.fn.webfonts.defaults, {
|
|
||||||
/**
|
/**
|
||||||
* Returns a suitable font from font repository based
|
* Returns a suitable font from font repository based
|
||||||
* on the given language and html classes and user preference.
|
* on the given language and html classes and user preference.
|
||||||
@@ -191,19 +187,20 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
exclude: ( function () {
|
exclude: ( function () {
|
||||||
var excludes = $.fn.webfonts.defaults.exclude;
|
var excludes = mw.config.get( 'wgULSNoWebfontsSelectors' ).join( ', ' );
|
||||||
|
|
||||||
if ( mw.user.options.get( 'editfont' ) !== 'default' ) {
|
if ( mw.user.options.get( 'editfont' ) !== 'default' ) {
|
||||||
// Exclude textboxes from webfonts if the user has edit area font option
|
// Exclude textboxes from webfonts if the user has edit area font option
|
||||||
// set using 'Preferences' page
|
// set using 'Preferences' page
|
||||||
excludes = ( excludes ) ?
|
excludes = excludes ? excludes + ',textarea' : 'textarea';
|
||||||
excludes + ',textarea' :
|
|
||||||
'textarea';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return excludes;
|
return excludes;
|
||||||
}() ),
|
}() ),
|
||||||
overridableFontFamilies: [ $( 'h1' ).css( 'font-family' ) ]
|
overridableFontFamilies: ( function () {
|
||||||
|
var headingFont = $( 'h1' ).css( 'font-family' );
|
||||||
|
return headingFont ? [ headingFont ] : [];
|
||||||
|
}() )
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Execute after task queue is processed so that the rendering is complete.
|
// Execute after task queue is processed so that the rendering is complete.
|
||||||
|
|||||||
Reference in New Issue
Block a user