Page MenuHomePhabricator

liquid.diff

Authored By
bzimport
Nov 21 2014, 8:48 PM
Size
4 KB
Referenced Files
None
Subscribers
None

liquid.diff

Index: phase3/skins/common/shared.css
===================================================================
--- phase3/skins/common/shared.css (revision 77022)
+++ phase3/skins/common/shared.css (working copy)
@@ -786,31 +786,35 @@
}
/* Galleries */
-table.gallery {
- border: 1px solid #ccc;
+/*These display attributes look non-sensical, but are needed to support IE and FF2*/
+li.gallerybox {
+ vertical-align: top;
+ background-color: #f9f9f9;
+ border: solid 2px white;
margin: 2px;
+ display:-moz-inline-box;
+}
+ul.gallery {
+ margin: 2px;
padding: 2px;
background-color: white;
+ display:block;
}
-table.gallery tr {
- vertical-align: top;
+ul.gallery, li.gallerybox {
+ display:inline-block;
+ zoom:1;
+ *display:inline;
}
-table.gallery td {
- vertical-align: top;
- background-color: #f9f9f9;
- border: solid 2px white;
-}
-table.gallery caption {
+li.gallerycaption {
font-weight: bold;
+ text-align: center;
+ display: block;
+ word-wrap: break-word;
}
-div.gallerybox {
- margin: 2px;
-}
-
-div.gallerybox div.thumb {
+li.gallerybox div.thumb {
text-align: center;
border: 1px solid #ccc;
margin: 2px;
Index: phase3/includes/DefaultSettings.php
===================================================================
--- phase3/includes/DefaultSettings.php (revision 77022)
+++ phase3/includes/DefaultSettings.php (working copy)
@@ -886,7 +886,7 @@
* Default parameters for the <gallery> tag
*/
$wgGalleryOptions = array (
- 'imagesPerRow' => 4, // Default number of images per-row in the gallery
+ 'imagesPerRow' => 0, // Default number of images per-row in the gallery. 0 -> Adapt to screensize
'imageWidth' => 120, // Width of the cells containing images in galleries (in "px")
'imageHeight' => 120, // Height of the cells containing images in galleries (in "px")
'captionLength' => 20, // Length of caption to truncate (in characters)
Index: phase3/includes/ImageGallery.php
===================================================================
--- phase3/includes/ImageGallery.php (revision 77022)
+++ phase3/includes/ImageGallery.php (working copy)
@@ -85,10 +85,11 @@
/**
* Set how many images will be displayed per row.
*
- * @param $num Integer > 0; invalid numbers will be rejected
+ * @param $num Integer >= 0; If perrow=0 the gallery layout will adapt to screensize
+ * invalid numbers will be rejected
*/
public function setPerRow( $num ) {
- if ($num > 0) {
+ if ($num >= 0) {
$this->mPerRow = (int)$num;
}
}
@@ -198,7 +199,7 @@
/**
* Set arbitrary attributes to go on the HTML gallery output element.
- * Should be suitable for a &lt;table&gt; element.
+ * Should be suitable for a <ul> element.
*
* Note -- if taking from user input, you should probably run through
* Sanitizer::validateAttributes() first.
@@ -224,15 +225,18 @@
$sk = $this->getSkin();
+ if ($this->mPerRow > 0) {
+ $maxwidth = $this->mPerRow * ($this->mWidths+50);
+ $this->mAttribs['style'] = 'max-width:'.$maxwidth.'px;'.'_width:'.$maxwidth.'px;';
+ }
+
$attribs = Sanitizer::mergeAttributes(
array(
- 'class' => 'gallery',
- 'cellspacing' => '0',
- 'cellpadding' => '0' ),
+ 'class' => 'gallery'),
$this->mAttribs );
- $s = Xml::openElement( 'table', $attribs );
+ $s = Xml::openElement( 'ul', $attribs );
if( $this->mCaption )
- $s .= "\n\t<caption>{$this->mCaption}</caption>";
+ $s .= "\n\t<li class='gallerycaption'>{$this->mCaption}</li>";
$params = array( 'width' => $this->mWidths, 'height' => $this->mHeights );
$i = 0;
@@ -325,25 +329,18 @@
# in version 4.8.6 generated crackpot html in its absence, see:
# http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
- if ( $i % $this->mPerRow == 0 ) {
- $s .= "\n\t<tr>";
- }
+ # Weird double wrapping in Div needed due to FF2 bug
+ # Can be safely removed if FF2 falls completely out of existance
$s .=
- "\n\t\t" . '<td><div class="gallerybox" style="width: '.($this->mWidths+35).'px;">'
+ "\n\t\t" . '<li class="gallerybox" style="width: '.($this->mWidths+35).'px;"><div style="width: '.($this->mWidths+35).'px;">'
. $thumbhtml
. "\n\t\t\t" . '<div class="gallerytext">' . "\n"
. $textlink . $text . $nb
. "\n\t\t\t</div>"
- . "\n\t\t</div></td>";
- if ( $i % $this->mPerRow == $this->mPerRow - 1 ) {
- $s .= "\n\t</tr>";
- }
+ . "\n\t\t</div></li>";
++$i;
}
- if( $i % $this->mPerRow != 0 ) {
- $s .= "\n\t</tr>";
- }
- $s .= "\n</table>";
+ $s .= "\n</ul>";
return $s;
}

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1855
Default Alt Text
liquid.diff (4 KB)

Event Timeline