Add support for multiple ULS buttons
- Update document click handler for loading ULS - Use data attributes to ensure ULS isnt loaded multiple times for an element Bug: T289815 Change-Id: Iba6cbbd6c6e48a1abfda342421822e3ff2715362
This commit is contained in:
@@ -442,6 +442,11 @@
|
||||
var $target = $( ev.currentTarget );
|
||||
ev.preventDefault();
|
||||
|
||||
// Avoid reinitializing ULS multiple times for an element
|
||||
if ( $target.attr( 'data-uls-loaded' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
mw.loader.using( 'ext.uls.mediawiki' ).then( function () {
|
||||
var parent, languageNodes, standalone, uls;
|
||||
|
||||
@@ -449,6 +454,8 @@
|
||||
languageNodes = parent ? parent.querySelectorAll( '.interlanguage-link-target' ) : [];
|
||||
standalone = isUsingStandaloneLanguageButton();
|
||||
|
||||
$target.attr( 'data-uls-loaded', true );
|
||||
|
||||
// Setup click handler for ULS
|
||||
launchULS(
|
||||
$target,
|
||||
@@ -483,7 +490,8 @@
|
||||
// if there are many languages. Warning: Both this module and ext.uls.compactlinks
|
||||
// module may run simultaneously. Using event delegation to avoid race conditions where
|
||||
// the trigger may be created after this code.
|
||||
$( document ).one( 'click', '.mw-interlanguage-selector', loadContentLanguageSelector );
|
||||
$( document ).on( 'click', '.mw-interlanguage-selector', loadContentLanguageSelector );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user