From 2edfe7c80e052ea352881c772ce62639ece2e34a Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 7 May 2014 19:49:25 +0200 Subject: [PATCH] mediawiki.page.watch.ajax: Don't use deprecated tooltipAccessKeyRegexp Remove dependency on 'mediawiki.page.startup' since this is no longer needed (it was there to ensure mw.util.init, which used to populate mw.util.tooltipAccessKeyRegexp, ran first). Change-Id: Iceecc228bce676de84de35220fa4d217be0f0b75 --- resources/Resources.php | 4 ++-- resources/src/mediawiki.page/mediawiki.page.watch.ajax.js | 8 +++----- resources/src/mediawiki/mediawiki.util.js | 8 ++++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/resources/Resources.php b/resources/Resources.php index 6057b39417..93022b225d 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -1136,10 +1136,10 @@ return array( 'mediawiki.page.watch.ajax' => array( 'scripts' => 'resources/src/mediawiki.page/mediawiki.page.watch.ajax.js', 'dependencies' => array( - 'mediawiki.page.startup', 'mediawiki.api.watch', - 'mediawiki.util', 'mediawiki.notify', + 'mediawiki.util', + 'jquery.accessKeyLabel', 'jquery.mwExtension', ), 'messages' => array( diff --git a/resources/src/mediawiki.page/mediawiki.page.watch.ajax.js b/resources/src/mediawiki.page/mediawiki.page.watch.ajax.js index 850177f433..3b0aeee92f 100644 --- a/resources/src/mediawiki.page/mediawiki.page.watch.ajax.js +++ b/resources/src/mediawiki.page/mediawiki.page.watch.ajax.js @@ -17,7 +17,7 @@ * @param {string} [state="idle"] 'idle' or 'loading'. Default is 'idle' */ function updateWatchLink( $link, action, state ) { - var accesskeyTip, msgKey, $li, otherAction; + var msgKey, $li, otherAction; // A valid but empty jQuery object shouldn't throw a TypeError if ( !$link.length ) { @@ -32,7 +32,6 @@ // message keys 'watch', 'watching', 'unwatch' or 'unwatching'. msgKey = state === 'loading' ? action + 'ing' : action; otherAction = action === 'watch' ? 'unwatch' : 'watch'; - accesskeyTip = $link.attr( 'title' ).match( mw.util.tooltipAccessKeyRegexp ); $li = $link.closest( 'li' ); // Trigger a 'watchpage' event for this List item. @@ -45,9 +44,8 @@ $link .text( mw.msg( msgKey ) ) - .attr( 'title', mw.msg( 'tooltip-ca-' + action ) + - ( accesskeyTip ? ' ' + accesskeyTip[0] : '' ) - ) + .attr( 'title', mw.msg( 'tooltip-ca-' + action ) ) + .updateTooltipAccessKeys() .attr( 'href', mw.util.wikiScript() + '?' + $.param( { title: title, action: action diff --git a/resources/src/mediawiki/mediawiki.util.js b/resources/src/mediawiki/mediawiki.util.js index 221ac745f6..298415cb6a 100644 --- a/resources/src/mediawiki/mediawiki.util.js +++ b/resources/src/mediawiki/mediawiki.util.js @@ -474,10 +474,10 @@ * * Should match: * - * - "ctrl-option-" - * - "alt-shift-" - * - "ctrl-alt-" - * - "ctrl-" + * - "[ctrl-option-x]" + * - "[alt-shift-x]" + * - "[ctrl-alt-x]" + * - "[ctrl-x]" * * The accesskey is matched in group $6. * -- 2.20.1