Fix regression from r37834: accesskey tooltip hint should be given for the minor edit and watch labels on the edit page. This code could still use refactoring, but that's a separate issue. :)
I relied on the fact that $n is usable to catch back-references in JavaScript replacement text -- this seems to work in latest-ish versions of Firefox, Konqueror, and Opera, so I'm assuming it works everywhere. ;) As usual, the Web gives tons of dodgy-looking cookbooks with no useful info whenever I try to search for anything JavaScript-related. Since I'm backporting this to 1.13 as a regression fix, this fix causes no change from 1.12 or 1.13 and so I'm not putting it in the release notes.
This commit is contained in:
parent
2658e07fb9
commit
f2a1ec41d3
3 changed files with 25 additions and 14 deletions
|
|
@ -1994,7 +1994,7 @@ END
|
|||
);
|
||||
$checkboxes['minor'] =
|
||||
Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
|
||||
" <label for='wpMinoredit'".$skin->tooltip('minoredit').">{$minorLabel}</label>";
|
||||
" <label for='wpMinoredit'".$skin->tooltip('minoredit', 'withaccess').">{$minorLabel}</label>";
|
||||
}
|
||||
|
||||
$watchLabel = wfMsgExt('watchthis', array('parseinline'));
|
||||
|
|
@ -2007,7 +2007,7 @@ END
|
|||
);
|
||||
$checkboxes['watch'] =
|
||||
Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
|
||||
" <label for='wpWatchthis'".$skin->tooltip('watch').">{$watchLabel}</label>";
|
||||
" <label for='wpWatchthis'".$skin->tooltip('watch', 'withaccess').">{$watchLabel}</label>";
|
||||
}
|
||||
return $checkboxes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1667,9 +1667,9 @@ class Linker {
|
|||
$attribs['accesskey'] = $accesskey;
|
||||
}
|
||||
|
||||
$out = Xml::expandAttributes( $attribs );
|
||||
$ret = Xml::expandAttributes( $attribs );
|
||||
wfProfileOut( __METHOD__ );
|
||||
return $out;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1678,20 +1678,32 @@ class Linker {
|
|||
* isn't always, because sometimes the accesskey needs to go on a different
|
||||
* element than the id, for reverse-compatibility, etc.)
|
||||
*
|
||||
* @param string $name Id of the element, minus prefixes.
|
||||
* @param string $name Id of the element, minus prefixes.
|
||||
* @param mixed $options null or the string 'withaccess' to add an access-
|
||||
* key hint
|
||||
* @return string title attribute, ready to drop in an element
|
||||
* (e.g., ' title="This does something"').
|
||||
*/
|
||||
public function tooltip( $name ) {
|
||||
public function tooltip( $name, $options = null ) {
|
||||
wfProfileIn( __METHOD__ );
|
||||
|
||||
$attribs = array();
|
||||
|
||||
$tooltip = wfMsg( "tooltip-$name" );
|
||||
if ( !wfEmptyMsg( "tooltip-$name", $tooltip ) && $tooltip != '-' ) {
|
||||
wfProfileOut( __METHOD__ );
|
||||
return ' title="'.htmlspecialchars( $tooltip ).'"';
|
||||
if( !wfEmptyMsg( "tooltip-$name", $tooltip ) && $tooltip != '-' ) {
|
||||
$attribs['title'] = $tooltip;
|
||||
}
|
||||
|
||||
if( isset( $attribs['title'] ) && $options == 'withaccess' ) {
|
||||
$accesskey = wfMsg( "accesskey-$name" );
|
||||
if( $accesskey && $accesskey != '-' &&
|
||||
!wfEmptyMsg( "accesskey-$name", $accesskey ) ) {
|
||||
$attribs['title'] .= " [$accesskey]";
|
||||
}
|
||||
}
|
||||
|
||||
$ret = Xml::expandAttributes( $attribs );
|
||||
wfProfileOut( __METHOD__ );
|
||||
return '';
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ if (is_opera) {
|
|||
} else if (is_ff2) {
|
||||
tooltipAccessKeyPrefix = 'alt-shift-';
|
||||
}
|
||||
var tooltipAccessKeyRegexp = /\[(ctrl-)?(alt-)?(shift-)?(esc-)?.\]$/;
|
||||
var tooltipAccessKeyRegexp = /\[(ctrl-)?(alt-)?(shift-)?(esc-)?(.)\]$/;
|
||||
|
||||
/**
|
||||
* Add the appropriate prefix to the accesskey shown in the tooltip.
|
||||
|
|
@ -240,10 +240,9 @@ function updateTooltipAccessKeys( nodeList ) {
|
|||
for ( var i = 0; i < nodeList.length; i++ ) {
|
||||
var element = nodeList[i];
|
||||
var tip = element.getAttribute("title");
|
||||
var key = element.getAttribute("accesskey");
|
||||
if ( key && tooltipAccessKeyRegexp.exec(tip) ) {
|
||||
if ( tip && tooltipAccessKeyRegexp.exec(tip) ) {
|
||||
tip = tip.replace(tooltipAccessKeyRegexp,
|
||||
"["+tooltipAccessKeyPrefix+key+"]");
|
||||
"["+tooltipAccessKeyPrefix+"$5]");
|
||||
element.setAttribute("title", tip );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue