mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-28 17:40:12 +00:00
2cf705bf79
Per comment in related patch d05f251
Change-Id: If49dfe55e8450f1a7ed6968f4907ae458072560a
42 lines
1 KiB
JavaScript
42 lines
1 KiB
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' ),
|
|
addInterlanguageLink;
|
|
|
|
if ( !$editLink.length ) {
|
|
return;
|
|
}
|
|
|
|
// @ts-ignore
|
|
addInterlanguageLink = mw.util.addPortletLink(
|
|
'p-tb',
|
|
$editLink.attr( 'href' ) || '#',
|
|
// Original text is "Edit links".
|
|
// Since its taken out of context the title is more descriptive.
|
|
$editLink.attr( 'title' ),
|
|
'wbc-editpage',
|
|
$editLink.attr( 'title' )
|
|
);
|
|
|
|
if ( addInterlanguageLink ) {
|
|
addInterlanguageLink.addEventListener( 'click', function ( /** @type {Event} */ e ) {
|
|
e.preventDefault();
|
|
// redirect to the detached and original edit link
|
|
$editLink.trigger( 'click' );
|
|
} );
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Initialize the language button.
|
|
*/
|
|
module.exports = function () {
|
|
addInterwikiLinkToMainMenu();
|
|
};
|