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