mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-23 16:06:53 +00:00
permalinks: Only handle unmodified left clicks
Allow using Ctrl+click to open the link in a new tab, or Alt+click to select the text, without annoying side effects. Change-Id: I3ab4c1ec3d5fc6c69e7f44489bbe63c536a64b91
This commit is contained in:
parent
9f9a73c746
commit
eb497b00c7
|
@ -1,5 +1,11 @@
|
||||||
|
const utils = require( './utils.js' );
|
||||||
|
|
||||||
function init( $pageContainer ) {
|
function init( $pageContainer ) {
|
||||||
$pageContainer.find( '.ext-discussiontools-init-timestamplink' ).on( 'click', ( e ) => {
|
$pageContainer.find( '.ext-discussiontools-init-timestamplink' ).on( 'click', ( e ) => {
|
||||||
|
if ( !utils.isUnmodifiedLeftClick( e ) ) {
|
||||||
|
// Only handle unmodified left clicks
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Try to percent-decode the URL, so that non-Latin characters don't look so ugly (T357021)
|
// Try to percent-decode the URL, so that non-Latin characters don't look so ugly (T357021)
|
||||||
// Use currentTarget rather than target to avoid conflicts with userscripts that do their
|
// Use currentTarget rather than target to avoid conflicts with userscripts that do their
|
||||||
// own timestamp-wrapping. (T368701)
|
// own timestamp-wrapping. (T368701)
|
||||||
|
|
Loading…
Reference in a new issue