From 6d8fcc59efa7cbc4da856ac54bdd583372ee1891 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 14 May 2011 09:27:36 +0000 Subject: [PATCH] * (bug 28945) Keyboard shortcuts on history page no longer work in 1.18 The link replacements for the button were dropping title & accesskey attributes, losing the shortcut key. Now copying these and replacing the buttons in-place, makes em work. --- .../mediawiki.action.history.js | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/resources/mediawiki.action/mediawiki.action.history.js b/resources/mediawiki.action/mediawiki.action.history.js index 580c570306..6674590a01 100644 --- a/resources/mediawiki.action/mediawiki.action.history.js +++ b/resources/mediawiki.action/mediawiki.action.history.js @@ -57,17 +57,21 @@ jQuery( function( $ ) { if ( !$buttons.length ) { return false; } - - var buttonText = $buttons.remove().first().val(), - $compareLink = $( '', { + var copyAttrs = ['title', 'accesskey']; + $buttons.each(function() { + var $button = $(this), + $compareLink= $( '', { 'class': 'compare-link', - 'text': buttonText + 'text': $button.val() }).button(); - $histForm.prepend( $compareLink ); - if ( $buttons.length == 2 ) { - $histForm.append( $compareLink.clone() ); - } - + $.each(copyAttrs, function(i, name) { + var val = $button.attr(name); + if (val) { + $compareLink.attr(name, val); + } + }); + $button.replaceWith($compareLink); + }); var updateCompare = function() { var $radio = $histForm.find( 'input[type=radio]:checked' ); var genLink = mw.config.get( 'wgScript' ) -- 2.20.1