mediawiki.page.watch.ajax: Don't use deprecated tooltipAccessKeyRegexp
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 7 May 2014 17:49:25 +0000 (19:49 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 7 May 2014 17:49:25 +0000 (19:49 +0200)
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
resources/src/mediawiki.page/mediawiki.page.watch.ajax.js
resources/src/mediawiki/mediawiki.util.js

index 6057b39..93022b2 100644 (file)
@@ -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(
index 850177f..3b0aeee 100644 (file)
@@ -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
index 221ac74..298415c 100644 (file)
         *
         * 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.
         *