Allow skins to register their own button and disable compact

Example usage:
Iabd4688c6081b4de391b9655b92a16f3a414e018

We will skip loading the compact link if we don't need
to compact the languages.

Note special handling is known for Timeless which stops
propagation of events. This will be fixed in Timeless at a
later date.

Bug: T264824
Change-Id: I0518ecdf402ebf5eb6bad2c430f6462322c0d8e1
This commit is contained in:
jdlrobson
2020-10-22 11:15:10 -07:00
committed by jenkins-bot
parent 077a3ac844
commit ab6decae11
4 changed files with 63 additions and 38 deletions

View File

@@ -20,8 +20,7 @@
( function () {
'use strict';
var DEFAULT_LIST_SIZE = 9,
launchULS = require( './ext.uls.launch.js' );
var DEFAULT_LIST_SIZE = 9;
/**
* @param {Array} target
@@ -179,7 +178,6 @@
this.compactList = this.getCompactList();
this.hideOriginal();
this.render();
this.listen();
};
/**
@@ -197,33 +195,6 @@
mw.hook( 'mw.uls.compactlinks.initialized' ).fire( true );
};
/**
* Attaches the actual selector to the trigger.
*
* @param {jQuery} $trigger Element to use as trigger.
*/
CompactInterlanguageList.prototype.createSelector = function ( $trigger ) {
launchULS(
$trigger,
this.interlanguageList
);
};
/**
* Bind to event handlers and listen for events
*/
CompactInterlanguageList.prototype.listen = function () {
var self = this;
this.$trigger.one( 'click', function () {
// Load the ULS now.
mw.loader.using( 'ext.uls.mediawiki' ).then( function () {
self.createSelector( self.$trigger );
self.$trigger.trigger( 'click' );
} );
} );
};
/**
* Get the compacted interlanguage list as associative array
*