mediawiki-skins-Vector/resources/skins.vector.js/languageButton.js
Jan Drewniak 443955249b Improve wikibase interlanguage link styles
Overrides the `wikibase.client.init` module to
better style the interlanguage link button in
Vector 2022.

Also adds the `.mw-list-item` class to that link
so that it maintains consistency with the other
menu list items.

Bug: T328069
Change-Id: I5c84b7f036afb4b8dc11e92a59dff8000f068e67
2023-02-03 14:14:08 -05:00

28 lines
935 B
JavaScript

/**
* Copies interwiki links to main menu
*
* Temporary solution to T287206, can be removed when the new ULS built in Vue.js
* has been released and contains this
*/
function addInterwikiLinkToMainMenu() {
// eslint-disable-next-line no-jquery/no-global-selector
var $editLink = $( '#p-lang-btn .wbc-editpage' );
if ( $editLink.length ) {
// Use title attribute for link text
$editLink.text( $editLink.attr( 'title' ) || '' );
var $li = $( '<li>' )
// If the Wikibase code runs last, this class is required so it matches the selector @:
// https://gerrit.wikimedia.org/g/mediawiki/extensions/Wikibase/+/f2e96e1b08fc5ae2e2e92f05d5eda137dc6b1bc8/client/resources/wikibase.client.linkitem.init.js#82
.addClass( 'wb-langlinks-link mw-list-item' )
.append( $editLink );
$li.appendTo( '#p-tb ul' );
}
}
/**
* Initialize the language button.
*/
module.exports = function () {
addInterwikiLinkToMainMenu();
};