Revise logic for creating compact links button on Vector 2022

The existing strpos code is not working and the code is loading on
Vector 2022, it also appears to be required on Vector 2022 as without
it the language button does not appear to work (these should be
decoupled in a later patch)

The easiest possible solution here, is to move the check to the
client side and not create the trigger button in Vector 2022. e.g. do
the equivalent check for the node existence in the client instead
of the server side.

Bug: T353850
Change-Id: I44835e672bce97a7d3a98d9d75c4805ee2cc448d
This commit is contained in:
Jon Robson
2024-01-02 11:02:17 -08:00
committed by jenkins-bot
parent 3b545d5a23
commit 14e3be1cd3
2 changed files with 10 additions and 9 deletions

View File

@@ -189,10 +189,13 @@
for ( language in this.compactList ) {
this.compactList[ language ].parentNode.style.display = '';
}
mw.loader.using( '@wikimedia/codex' ).then( function () {
this.addTrigger();
}.bind( this ) );
// If there is an interlanguage selector in the page already
// there is no need to add a trigger and Codex styles (T353850).
if ( !$( '.mw-interlanguage-selector' ).length ) {
mw.loader.using( '@wikimedia/codex' ).then( function () {
this.addTrigger();
}.bind( this ) );
}
mw.hook( 'mw.uls.compactlinks.initialized' ).fire( true );
};