Compact language links: Delay loading of jquery.uls module
Load jquery.uls only when the trigger is clicked. Reduces the initial footprint by 63.9 KB (uncompressed) Bug: T135210 Change-Id: I972cb6ea1794485917ea530f7abe68bdddc2014f
This commit is contained in:
@@ -242,7 +242,6 @@
|
|||||||
"styles": "css/ext.uls.compactlinks.less",
|
"styles": "css/ext.uls.compactlinks.less",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"es5-shim",
|
"es5-shim",
|
||||||
"jquery.uls.compact",
|
|
||||||
"mediawiki.language",
|
"mediawiki.language",
|
||||||
"mediawiki.ui.button"
|
"mediawiki.ui.button"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mw.loader.using( 'ext.uls.mediawiki' ).done( function () {
|
mw.loader.using( 'ext.uls.init' ).done( function () {
|
||||||
// If we're only a bit beyond max, limit to 7 instead of 9.
|
// If we're only a bit beyond max, limit to 7 instead of 9.
|
||||||
// FIXME: This assumes the max is 9.
|
// FIXME: This assumes the max is 9.
|
||||||
self.compactSize = ( self.listSize <= 12 ) ? 7 : max;
|
self.compactSize = ( self.listSize <= 12 ) ? 7 : max;
|
||||||
@@ -187,8 +187,11 @@
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.$trigger.one( 'click', function () {
|
this.$trigger.one( 'click', function () {
|
||||||
self.createSelector( self.$trigger );
|
// Load the ULS now.
|
||||||
self.$trigger.click();
|
mw.loader.using( 'ext.uls.mediawiki' ).done( function () {
|
||||||
|
self.createSelector( self.$trigger );
|
||||||
|
self.$trigger.click();
|
||||||
|
} );
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user