Permalink copying: use currentTarget to avoid conflicts with userscripts

Bug: T368701
Change-Id: I70b1cbf8aaf917ed843f003eec7bbd61db39ecc7
This commit is contained in:
David Lynch 2024-06-28 10:17:27 -05:00
parent 12bca79877
commit cd39c267b5

View file

@ -1,7 +1,9 @@
function init( $pageContainer ) { function init( $pageContainer ) {
$pageContainer.find( '.ext-discussiontools-init-timestamplink' ).on( 'click', ( e ) => { $pageContainer.find( '.ext-discussiontools-init-timestamplink' ).on( 'click', ( e ) => {
// 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)
let link = e.target.href; // Use currentTarget rather than target to avoid conflicts with userscripts that do their
// own timestamp-wrapping. (T368701)
let link = e.currentTarget.href;
try { try {
// decodeURI() may throw // decodeURI() may throw
const decodedLink = decodeURI( e.target.href ); const decodedLink = decodeURI( e.target.href );