Page MenuHomePhabricator

thumbnailer-patch.diff

Authored By
bzimport
Nov 22 2014, 12:17 AM
Size
3 KB
Referenced Files
None
Subscribers
None

thumbnailer-patch.diff

Index: includes/Linker.php
===================================================================
--- includes/Linker.php (Revision 111457)
+++ includes/Linker.php (Arbeitskopie)
@@ -726,33 +726,32 @@
$s = "<div class=\"thumb t{$fp['align']}\"><div class=\"thumbinner\" style=\"width:{$outerWidth}px;\">";
if ( !$exists ) {
$s .= self::makeBrokenImageLinkObj( $title, $fp['title'], '', '', '', $time == true );
- $zoomIcon = '';
} elseif ( !$thumb ) {
$s .= htmlspecialchars( wfMsg( 'thumbnail_error', '' ) );
- $zoomIcon = '';
} else {
$params = array(
'alt' => $fp['alt'],
'title' => $fp['title'],
'img-class' => 'thumbimage' );
$params = self::getImageLinkMTOParams( $fp, $query ) + $params;
- $s .= $thumb->toHtml( $params );
- if ( isset( $fp['framed'] ) ) {
- $zoomIcon = "";
- } else {
+ $zoomIcon = '';
+ if ( !isset( $fp['framed'] ) ) {
$zoomIcon = Html::rawElement( 'div', array( 'class' => 'magnify' ),
- Html::rawElement( 'a', array(
- 'href' => $url,
- 'class' => 'internal',
- 'title' => wfMsg( 'thumbnail-more' ) ),
- Html::element( 'img', array(
- 'src' => $wgStylePath . '/common/images/magnify-clip' . ( $wgContLang->isRTL() ? '-rtl' : '' ) . '.png',
- 'width' => 15,
- 'height' => 11,
- 'alt' => "" ) ) ) );
+ Html::element( 'img', array(
+ 'src' => $wgStylePath . '/common/images/magnify-clip' . ( $wgContLang->isRTL() ? '-rtl' : '' ) . '.png',
+ 'width' => 15,
+ 'height' => 11,
+ 'alt' => "" ) ) );
}
+
+ $params['desc-link'] = false;
+ $imgHtml = $thumb->toHtml( $params );
+ $linkAttribs = $thumb->getDescLinkAttribs(empty( $params['title'] ) ? null : $params['title'], $query);
+ $linkHtml = Xml::tags( 'a', $linkAttribs, $imgHtml . $zoomIcon );
+
+ $s .= $linkHtml;
}
- $s .= ' <div class="thumbcaption">' . $zoomIcon . $fp['caption'] . "</div></div></div>";
+ $s .= '<div class="thumbcaption">' . $fp['caption'] . '</div></div></div>';
return str_replace( "\n", ' ', $s );
}
Index: includes/parser/Parser.php
===================================================================
--- includes/parser/Parser.php (Revision 111457)
+++ includes/parser/Parser.php (Arbeitskopie)
@@ -4908,10 +4908,14 @@
# plicit caption= parameter and preserving the old magic unnamed para-
# meter for BC; ...
if ( $imageIsFramed ) { # Framed image
- if ( $caption === '' && !isset( $params['frame']['alt'] ) ) {
+ if ( !isset( $params['frame']['alt'] ) ) {
# No caption or alt text, add the filename as the alt text so
# that screen readers at least get some description of the image
- $params['frame']['alt'] = $title->getText();
+ $params['frame']['alt'] = wfMessage('tooltip-ca-nstab-media')
+ ->inContentLanguage()->plain();
+ if ( $caption === '' ) {
+ $params['frame']['alt'] .= ": " . $title->mTextform;
+ }
}
# Do not set $params['frame']['title'] because tooltips don't make sense
# for framed images
Index: skins/common/shared.css
===================================================================
--- skins/common/shared.css (Revision 111457)
+++ skins/common/shared.css (Arbeitskopie)
@@ -165,7 +165,10 @@
* Image captions
*/
.thumbcaption { text-align: left; }
-.magnify { float: right; }
+.magnify {
+ padding: 4px 2px 0 2px;
+ float: right;
+}
/**
* Categories

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8621
Default Alt Text
thumbnailer-patch.diff (3 KB)

Event Timeline