CompactLinks: Better handling of opening links to new tab/window
* Check for any of Shift, Ctrl or Meta * Only do it for links * Support both mouse and keyboard Change-Id: I0b331b802e1d96ae0e0511746d6b42663db924b1
This commit is contained in:
committed by
jenkins-bot
parent
78884e87b2
commit
4387bb9d61
@@ -52,11 +52,15 @@ function launchULS( $trigger, languagesObject ) {
|
|||||||
$trigger.removeClass( 'selector-open' );
|
$trigger.removeClass( 'selector-open' );
|
||||||
mw.uls.addPreviousLanguage( language );
|
mw.uls.addPreviousLanguage( language );
|
||||||
|
|
||||||
// Switch the current tab to the new language,
|
// Switch the current tab to the new language, unless it was
|
||||||
// unless it was Ctrl-click or Command-click
|
// {Ctrl,Shift,Command} activation on a link
|
||||||
if ( !event.metaKey && !event.shiftKey ) {
|
if (
|
||||||
location.href = languagesObject[ language ].href;
|
event.target instanceof HTMLAnchorElement &&
|
||||||
|
( event.metaKey || event.shiftKey || event.ctrlKey )
|
||||||
|
) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
location.href = languagesObject[ language ].href;
|
||||||
},
|
},
|
||||||
onVisible: function () {
|
onVisible: function () {
|
||||||
var offset, height, width, triangleWidth;
|
var offset, height, width, triangleWidth;
|
||||||
|
|||||||
Reference in New Issue
Block a user