Nikerabbit has uploaded a new change for review.
https://gerrit.wikimedia.org/r/172022
Change subject: Fix JavaScript error on pages without headings
......................................................................
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
---
M resources/js/ext.uls.webfonts.js
1 file changed, 14 insertions(+), 17 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector
refs/changes/22/172022/1
diff --git a/resources/js/ext.uls.webfonts.js b/resources/js/ext.uls.webfonts.js
index 9bc30ca..745549a 100644
--- a/resources/js/ext.uls.webfonts.js
+++ b/resources/js/ext.uls.webfonts.js
@@ -129,18 +129,14 @@
$.extend( $.fn.webfonts.defaults, {
repository: mediawikiFontRepository,
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
- * on the given language and html classes and user
preference.
- *
- * @param {Object} repository
- * @param {string} language
- * @param {array} classes
- */
+ /**
+ * Returns a suitable font from font repository based
+ * on the given language and html classes and user
preference.
+ *
+ * @param {Object} repository
+ * @param {string} language
+ * @param {array} classes
+ */
fontSelector: function ( repository, language, classes
) {
var font, autonym, defaultFont;
@@ -191,19 +187,20 @@
},
exclude: ( function () {
- var excludes = $.fn.webfonts.defaults.exclude;
+ var excludes = mw.config.get(
'wgULSNoWebfontsSelectors' ).join( ', ' );
if ( mw.user.options.get( 'editfont' ) !==
'default' ) {
// Exclude textboxes from webfonts if
the user has edit area font option
// set using 'Preferences' page
- excludes = ( excludes ) ?
- excludes + ',textarea' :
- 'textarea';
+ excludes = excludes ? excludes +
',textarea' : 'textarea';
}
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.
--
To view, visit https://gerrit.wikimedia.org/r/172022
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic33f3934166f4feb6dd088ca0d14e249fcf237a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits