From: Brion Vibber Date: Sat, 14 May 2011 09:27:36 +0000 (+0000) Subject: * (bug 28945) Keyboard shortcuts on history page no longer work in 1.18 X-Git-Tag: 1.31.0-rc.0~30222 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22messagerie%22%29%20.%20%22?a=commitdiff_plain;h=6d8fcc59efa7cbc4da856ac54bdd583372ee1891;p=lhc%2Fweb%2Fwiklou.git * (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. --- 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' )