Yurik has uploaded a new change for review.
https://gerrit.wikimedia.org/r/263163
Change subject: Removed duplicate alt & title attributes
......................................................................
Removed duplicate alt & title attributes
Change-Id: I63062871777a8c22c9d52ddf75d2e78b0191cadd
---
M includes/Graph.body.php
1 file changed, 21 insertions(+), 19 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Graph
refs/changes/63/263163/1
diff --git a/includes/Graph.body.php b/includes/Graph.body.php
index 0c06206..8e20329 100644
--- a/includes/Graph.body.php
+++ b/includes/Graph.body.php
@@ -202,34 +202,36 @@
$title = !$title ? '' : rawurlencode(
$title->getPrefixedDBkey() );
$revid = rawurlencode( (string)$revid ) ?: '0';
$url = sprintf( $wgGraphImgServiceUrl, $server, $title,
$revid, $hash );
- $html = Html::rawElement( 'img', array(
- 'class' => 'mw-graph-img',
- 'src' => $url,
- 'alt' => $graphTitle,
- 'title' => $graphTitle,
- ) );
+ $imgAttrs = array(
+ 'class' => 'mw-graph-img',
+ 'src' => $url,
+ );
+ if ( $graphTitle ) {
+ // only add alt tag if we have some descriptive
text
+ $imgAttrs['alt'] = $graphTitle;
+ }
+ $html = Html::rawElement( 'img', $imgAttrs );
if ( $isInteractive ) {
// Allow image to interactive switchover
$parserOutput->setExtensionData(
'graph_interact', true );
$attribs = self::buildDivAttributes(
'interactable', $data, $hash );
+ // add the overlay title
+ if ( $graphTitle ) {
+ $hoverTitle = Html::element( 'div',
array( 'class' => 'mw-graph-hover-title' ),
+ $graphTitle );
+ } else {
+ $hoverTitle = '';
+ }
+
// Add a "make interactive" button
- $buttonIcon = Html::rawElement( 'i', array(
'class' => 'icon-play' ), '►' );
+ $button = Html::rawElement( 'div', array(
'class' => 'mw-graph-switch' ),
+ Html::rawElement( 'i', array( 'class'
=> 'icon-play' ), '►' ) );
- $button = Html::rawElement( 'div', array(
- 'class' => 'mw-graph-switch',
- ), $buttonIcon );
-
- $hoverTitle = Html::element( 'div', array(
'class' => 'mw-graph-hover-title' ), $graphTitle );
-
- $layoverContent = $hoverTitle . $button;
-
- $layover = Html::rawElement( 'div', array(
+ $html .= Html::rawElement( 'div', array(
'class' => 'mw-graph-layover',
- ), $layoverContent );
-
- $html .= $layover;
+ ), $hoverTitle . $button );
} else {
$attribs = self::buildDivAttributes( '', $data
);
}
--
To view, visit https://gerrit.wikimedia.org/r/263163
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I63062871777a8c22c9d52ddf75d2e78b0191cadd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Graph
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits