Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4038129
languageButton.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
languageButton.js
View Options
/**
* 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
()
{
const
editLink
=
/** @type {HTMLElement|null} */
(
document
.
querySelector
(
'#p-lang-btn .wbc-editpage'
)
);
if
(
!
editLink
)
{
return
;
}
const
title
=
editLink
.
getAttribute
(
'title'
)
||
''
;
const
addInterlanguageLink
=
mw
.
util
.
addPortletLink
(
'p-tb'
,
editLink
.
getAttribute
(
'href'
)
||
'#'
,
// Original text is "Edit links".
// Since its taken out of context the title is more descriptive.
title
,
'wbc-editpage'
,
title
);
if
(
addInterlanguageLink
)
{
addInterlanguageLink
.
addEventListener
(
'click'
,
(
/** @type {Event} */
e
)
=>
{
e
.
preventDefault
();
// redirect to the detached and original edit link
editLink
.
click
();
}
);
}
}
/**
* Checks if ULS is disabled, and makes sure the language dropdown continues
* to work if it is.
*/
function
checkIfULSDisabled
()
{
const
langModuleState
=
mw
.
loader
.
getState
(
'ext.uls.interface'
);
if
(
langModuleState
===
null
||
langModuleState
===
'registered'
)
{
document
.
documentElement
.
classList
.
add
(
'vector-uls-disabled'
);
}
}
/**
* Initialize the language button.
*/
module
.
exports
=
function
()
{
checkIfULSDisabled
();
addInterwikiLinkToMainMenu
();
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 15 2026, 04:08 (13 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0c/67/d055af10ebe093fe5ffc8950b75c
Default Alt Text
languageButton.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment