2021-07-26 21:00:38 +00:00
|
|
|
/**
|
2022-10-17 20:09:53 +00:00
|
|
|
* Copies interwiki links to main menu
|
2021-07-26 21:00:38 +00:00
|
|
|
*
|
|
|
|
* Temporary solution to T287206, can be removed when the new ULS built in Vue.js
|
|
|
|
* has been released and contains this
|
|
|
|
*/
|
2022-10-17 20:09:53 +00:00
|
|
|
function addInterwikiLinkToMainMenu() {
|
2021-07-26 21:00:38 +00:00
|
|
|
// 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' ) || '' );
|
2021-08-10 20:17:30 +00:00
|
|
|
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' )
|
|
|
|
.append( $editLink );
|
2021-07-26 21:00:38 +00:00
|
|
|
$li.appendTo( '#p-tb ul' );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-01 21:32:25 +00:00
|
|
|
/**
|
|
|
|
* Initialize the language button.
|
|
|
|
*/
|
|
|
|
module.exports = function () {
|
2022-10-17 20:09:53 +00:00
|
|
|
addInterwikiLinkToMainMenu();
|
2021-03-01 21:32:25 +00:00
|
|
|
};
|