);
$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'));
);
$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;
}
$attribs['accesskey'] = $accesskey;
}
- $out = Xml::expandAttributes( $attribs );
+ $ret = Xml::expandAttributes( $attribs );
wfProfileOut( __METHOD__ );
- return $out;
+ return $ret;
}
/**
* 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;
}
}
} 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.
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 );
}
}