Merge "Ensure ext.uls.mediawiki is loaded before use"
This commit is contained in:
@@ -57,7 +57,9 @@
|
||||
* Initialize the plugin
|
||||
*/
|
||||
init: function () {
|
||||
var max = this.options.max;
|
||||
var self = this,
|
||||
max = this.options.max;
|
||||
|
||||
this.interlanguageList = this.getInterlanguageList();
|
||||
this.listSize = Object.keys( this.interlanguageList ).length;
|
||||
|
||||
@@ -66,13 +68,15 @@
|
||||
return;
|
||||
}
|
||||
|
||||
mw.loader.using( 'ext.uls.mediawiki' ).done( function () {
|
||||
// If we're only a bit beyond max, limit to 7 instead of 9.
|
||||
// FIXME: This assumes the max is 9.
|
||||
this.compactSize = ( this.listSize <= 12 ) ? 7 : max;
|
||||
this.compactList = this.getCompactList();
|
||||
this.hideOriginal();
|
||||
this.render();
|
||||
this.listen();
|
||||
self.compactSize = ( self.listSize <= 12 ) ? 7 : max;
|
||||
self.compactList = self.getCompactList();
|
||||
self.hideOriginal();
|
||||
self.render();
|
||||
self.listen();
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -105,7 +109,6 @@
|
||||
return languageCode;
|
||||
} );
|
||||
|
||||
return mw.loader.using( 'ext.uls.mediawiki' ).then( function () {
|
||||
// Attach ULS to the trigger
|
||||
$trigger.uls( {
|
||||
onReady: function () {
|
||||
@@ -174,7 +177,6 @@
|
||||
// Show common languages
|
||||
quickList: self.filterByCommonLanguages( languages )
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -184,10 +186,9 @@
|
||||
var self = this;
|
||||
|
||||
this.$trigger.one( 'click', function () {
|
||||
self.createSelector( self.$trigger ).then( function () {
|
||||
self.createSelector( self.$trigger );
|
||||
self.$trigger.click();
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user