Index: trunk/phase3/maintenance/tests/parser/parserTests.txt |
— | — | @@ -6607,48 +6607,44 @@ |
6608 | 6608 | * image6 |
6609 | 6609 | </gallery> |
6610 | 6610 | !! result |
6611 | | -<table class="gallery" cellspacing="0" cellpadding="0"> |
6612 | | - <tr> |
6613 | | - <td><div class="gallerybox" style="width: 155px;"> |
| 6611 | +<ul class="gallery"> |
| 6612 | + <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
6614 | 6613 | <div style="height: 152px;">Image1.png</div> |
6615 | 6614 | <div class="gallerytext"> |
6616 | 6615 | </div> |
6617 | | - </div></td> |
6618 | | - <td><div class="gallerybox" style="width: 155px;"> |
| 6616 | + </div></li> |
| 6617 | + <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
6619 | 6618 | <div style="height: 152px;">Image2.gif</div> |
6620 | 6619 | <div class="gallerytext"> |
6621 | 6620 | <p>|||| |
6622 | 6621 | </p> |
6623 | 6622 | </div> |
6624 | | - </div></td> |
6625 | | - <td><div class="gallerybox" style="width: 155px;"> |
| 6623 | + </div></li> |
| 6624 | + <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
6626 | 6625 | <div style="height: 152px;">Image3</div> |
6627 | 6626 | <div class="gallerytext"> |
6628 | 6627 | </div> |
6629 | | - </div></td> |
6630 | | - <td><div class="gallerybox" style="width: 155px;"> |
| 6628 | + </div></li> |
| 6629 | + <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
6631 | 6630 | <div style="height: 152px;">Image4</div> |
6632 | 6631 | <div class="gallerytext"> |
6633 | 6632 | <p>300px| centre |
6634 | 6633 | </p> |
6635 | 6634 | </div> |
6636 | | - </div></td> |
6637 | | - </tr> |
6638 | | - <tr> |
6639 | | - <td><div class="gallerybox" style="width: 155px;"> |
| 6635 | + </div></li> |
| 6636 | + <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
6640 | 6637 | <div style="height: 152px;">Image5.svg</div> |
6641 | 6638 | <div class="gallerytext"> |
6642 | 6639 | <p><a href="http://///////" class="external free" rel="nofollow">http://///////</a> |
6643 | 6640 | </p> |
6644 | 6641 | </div> |
6645 | | - </div></td> |
6646 | | - <td><div class="gallerybox" style="width: 155px;"> |
| 6642 | + </div></li> |
| 6643 | + <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
6647 | 6644 | <div style="height: 152px;">* image6</div> |
6648 | 6645 | <div class="gallerytext"> |
6649 | 6646 | </div> |
6650 | | - </div></td> |
6651 | | - </tr> |
6652 | | -</table> |
| 6647 | + </div></li> |
| 6648 | +</ul> |
6653 | 6649 | |
6654 | 6650 | !! end |
6655 | 6651 | |
— | — | @@ -6662,37 +6658,33 @@ |
6663 | 6659 | image:foobar.jpg |
6664 | 6660 | </gallery> |
6665 | 6661 | !! result |
6666 | | -<table class="gallery" cellspacing="0" cellpadding="0"> |
6667 | | - <caption>Foo <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a></caption> |
6668 | | - <tr> |
6669 | | - <td><div class="gallerybox" style="width: 95px;"> |
| 6662 | +<ul class="gallery" style="max-width: 220px;_width: 220px;"> |
| 6663 | + <li class='gallerycaption'>Foo <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a></li> |
| 6664 | + <li class="gallerybox" style="width: 95px"><div style="width: 95px"> |
6670 | 6665 | <div style="height: 52px;">Nonexistant.jpg</div> |
6671 | 6666 | <div class="gallerytext"> |
6672 | 6667 | <p>caption |
6673 | 6668 | </p> |
6674 | 6669 | </div> |
6675 | | - </div></td> |
6676 | | - <td><div class="gallerybox" style="width: 95px;"> |
| 6670 | + </div></li> |
| 6671 | + <li class="gallerybox" style="width: 95px"><div style="width: 95px"> |
6677 | 6672 | <div style="height: 52px;">Nonexistant.jpg</div> |
6678 | 6673 | <div class="gallerytext"> |
6679 | 6674 | </div> |
6680 | | - </div></td> |
6681 | | - </tr> |
6682 | | - <tr> |
6683 | | - <td><div class="gallerybox" style="width: 95px;"> |
| 6675 | + </div></li> |
| 6676 | + <li class="gallerybox" style="width: 95px"><div style="width: 95px"> |
6684 | 6677 | <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div> |
6685 | 6678 | <div class="gallerytext"> |
6686 | 6679 | <p>some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a> |
6687 | 6680 | </p> |
6688 | 6681 | </div> |
6689 | | - </div></td> |
6690 | | - <td><div class="gallerybox" style="width: 95px;"> |
| 6682 | + </div></li> |
| 6683 | + <li class="gallerybox" style="width: 95px"><div style="width: 95px"> |
6691 | 6684 | <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div> |
6692 | 6685 | <div class="gallerytext"> |
6693 | 6686 | </div> |
6694 | | - </div></td> |
6695 | | - </tr> |
6696 | | -</table> |
| 6687 | + </div></li> |
| 6688 | +</ul> |
6697 | 6689 | |
6698 | 6690 | !! end |
6699 | 6691 | |
— | — | @@ -6706,40 +6698,38 @@ |
6707 | 6699 | File:Foobar.jpg |
6708 | 6700 | </gallery> |
6709 | 6701 | !! result |
6710 | | -<table class="gallery" cellspacing="0" cellpadding="0"> |
6711 | | - <tr> |
6712 | | - <td><div class="gallerybox" style="width: 155px;"> |
| 6702 | +<ul class="gallery"> |
| 6703 | + <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
6713 | 6704 | <div style="height: 152px;">Nonexistant.jpg</div> |
6714 | 6705 | <div class="gallerytext"> |
6715 | 6706 | <p><a href="https://www.mediawiki.org/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br /> |
6716 | 6707 | caption |
6717 | 6708 | </p> |
6718 | 6709 | </div> |
6719 | | - </div></td> |
6720 | | - <td><div class="gallerybox" style="width: 155px;"> |
| 6710 | + </div></li> |
| 6711 | + <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
6721 | 6712 | <div style="height: 152px;">Nonexistant.jpg</div> |
6722 | 6713 | <div class="gallerytext"> |
6723 | 6714 | <p><a href="https://www.mediawiki.org/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br /> |
6724 | 6715 | </p> |
6725 | 6716 | </div> |
6726 | | - </div></td> |
6727 | | - <td><div class="gallerybox" style="width: 155px;"> |
| 6717 | + </div></li> |
| 6718 | + <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
6728 | 6719 | <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
6729 | 6720 | <div class="gallerytext"> |
6730 | 6721 | <p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br /> |
6731 | 6722 | some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page">Main Page</a> |
6732 | 6723 | </p> |
6733 | 6724 | </div> |
6734 | | - </div></td> |
6735 | | - <td><div class="gallerybox" style="width: 155px;"> |
| 6725 | + </div></li> |
| 6726 | + <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
6736 | 6727 | <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
6737 | 6728 | <div class="gallerytext"> |
6738 | 6729 | <p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br /> |
6739 | 6730 | </p> |
6740 | 6731 | </div> |
6741 | | - </div></td> |
6742 | | - </tr> |
6743 | | -</table> |
| 6732 | + </div></li> |
| 6733 | +</ul> |
6744 | 6734 | |
6745 | 6735 | !! end |
6746 | 6736 | |
Index: trunk/phase3/skins/common/shared.css |
— | — | @@ -786,31 +786,34 @@ |
787 | 787 | } |
788 | 788 | |
789 | 789 | /* Galleries */ |
790 | | -table.gallery { |
791 | | - border: 1px solid #ccc; |
| 790 | +/* These display attributes look nonsensical, but are needed to support IE and FF2 */ |
| 791 | +li.gallerybox { |
| 792 | + vertical-align: top; |
| 793 | + background-color: #f9f9f9; |
| 794 | + border: solid 2px white; |
| 795 | + display: -moz-inline-box; |
| 796 | +} |
| 797 | +ul.gallery { |
792 | 798 | margin: 2px; |
793 | 799 | padding: 2px; |
794 | 800 | background-color: white; |
| 801 | + display: block; |
795 | 802 | } |
796 | 803 | |
797 | | -table.gallery tr { |
798 | | - vertical-align: top; |
| 804 | +ul.gallery, li.gallerybox { |
| 805 | + display: inline-block; |
| 806 | + zoom: 1; |
| 807 | + *display: inline; |
799 | 808 | } |
800 | 809 | |
801 | | -table.gallery td { |
802 | | - vertical-align: top; |
803 | | - background-color: #f9f9f9; |
804 | | - border: solid 2px white; |
805 | | -} |
806 | | -table.gallery caption { |
| 810 | +li.gallerycaption { |
807 | 811 | font-weight: bold; |
| 812 | + text-align: center; |
| 813 | + display: block; |
| 814 | + word-wrap: break-word; |
808 | 815 | } |
809 | 816 | |
810 | | -div.gallerybox { |
811 | | - margin: 2px; |
812 | | -} |
813 | | - |
814 | | -div.gallerybox div.thumb { |
| 817 | +li.gallerybox div.thumb { |
815 | 818 | text-align: center; |
816 | 819 | border: 1px solid #ccc; |
817 | 820 | margin: 2px; |
Index: trunk/phase3/CREDITS |
— | — | @@ -85,6 +85,7 @@ |
86 | 86 | * Daniel Arnold |
87 | 87 | * Denny Vrandecic |
88 | 88 | * Derk-Jan Hartman |
| 89 | +* DieBuche |
89 | 90 | * FunPika |
90 | 91 | * Ireas |
91 | 92 | * Jaska Zedlik |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -886,7 +886,7 @@ |
887 | 887 | * Default parameters for the <gallery> tag |
888 | 888 | */ |
889 | 889 | $wgGalleryOptions = array ( |
890 | | - 'imagesPerRow' => 4, // Default number of images per-row in the gallery |
| 890 | + 'imagesPerRow' => 0, // Default number of images per-row in the gallery. 0 -> Adapt to screensize |
891 | 891 | 'imageWidth' => 120, // Width of the cells containing images in galleries (in "px") |
892 | 892 | 'imageHeight' => 120, // Height of the cells containing images in galleries (in "px") |
893 | 893 | 'captionLength' => 20, // Length of caption to truncate (in characters) |
Index: trunk/phase3/includes/ImageGallery.php |
— | — | @@ -85,10 +85,11 @@ |
86 | 86 | /** |
87 | 87 | * Set how many images will be displayed per row. |
88 | 88 | * |
89 | | - * @param $num Integer > 0; invalid numbers will be rejected |
| 89 | + * @param $num Integer >= 0; If perrow=0 the gallery layout will adapt to screensize |
| 90 | + * invalid numbers will be rejected |
90 | 91 | */ |
91 | 92 | public function setPerRow( $num ) { |
92 | | - if ($num > 0) { |
| 93 | + if ($num >= 0) { |
93 | 94 | $this->mPerRow = (int)$num; |
94 | 95 | } |
95 | 96 | } |
— | — | @@ -198,7 +199,7 @@ |
199 | 200 | |
200 | 201 | /** |
201 | 202 | * Set arbitrary attributes to go on the HTML gallery output element. |
202 | | - * Should be suitable for a <table> element. |
| 203 | + * Should be suitable for a <ul> element. |
203 | 204 | * |
204 | 205 | * Note -- if taking from user input, you should probably run through |
205 | 206 | * Sanitizer::validateAttributes() first. |
— | — | @@ -224,15 +225,19 @@ |
225 | 226 | |
226 | 227 | $sk = $this->getSkin(); |
227 | 228 | |
| 229 | + if ( $this->mPerRow > 0 ) { |
| 230 | + $maxwidth = $this->mPerRow * ( $this->mWidths + 50 ); |
| 231 | + $this->mAttribs['style'] = "max-width: {$maxwidth}px;_width: {$maxwidth}px;"; |
| 232 | + } |
| 233 | + |
228 | 234 | $attribs = Sanitizer::mergeAttributes( |
229 | 235 | array( |
230 | | - 'class' => 'gallery', |
231 | | - 'cellspacing' => '0', |
232 | | - 'cellpadding' => '0' ), |
| 236 | + 'class' => 'gallery'), |
233 | 237 | $this->mAttribs ); |
234 | | - $s = Xml::openElement( 'table', $attribs ); |
235 | | - if( $this->mCaption ) |
236 | | - $s .= "\n\t<caption>{$this->mCaption}</caption>"; |
| 238 | + $s = Xml::openElement( 'ul', $attribs ); |
| 239 | + if ( $this->mCaption ) { |
| 240 | + $s .= "\n\t<li class='gallerycaption'>{$this->mCaption}</li>"; |
| 241 | + } |
237 | 242 | |
238 | 243 | $params = array( 'width' => $this->mWidths, 'height' => $this->mHeights ); |
239 | 244 | $i = 0; |
— | — | @@ -325,25 +330,19 @@ |
326 | 331 | # in version 4.8.6 generated crackpot html in its absence, see: |
327 | 332 | # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar |
328 | 333 | |
329 | | - if ( $i % $this->mPerRow == 0 ) { |
330 | | - $s .= "\n\t<tr>"; |
331 | | - } |
| 334 | + # Weird double wrapping in div needed due to FF2 bug |
| 335 | + # Can be safely removed if FF2 falls completely out of existance |
332 | 336 | $s .= |
333 | | - "\n\t\t" . '<td><div class="gallerybox" style="width: '.($this->mWidths+35).'px;">' |
| 337 | + "\n\t\t" . '<li class="gallerybox" style="width: ' . ( $this->mWidths + 35 ) . 'px">' |
| 338 | + . '<div style="width: ' . ( $this->mWidths + 35 ) . 'px">' |
334 | 339 | . $thumbhtml |
335 | 340 | . "\n\t\t\t" . '<div class="gallerytext">' . "\n" |
336 | 341 | . $textlink . $text . $nb |
337 | 342 | . "\n\t\t\t</div>" |
338 | | - . "\n\t\t</div></td>"; |
339 | | - if ( $i % $this->mPerRow == $this->mPerRow - 1 ) { |
340 | | - $s .= "\n\t</tr>"; |
341 | | - } |
| 343 | + . "\n\t\t</div></li>"; |
342 | 344 | ++$i; |
343 | 345 | } |
344 | | - if( $i % $this->mPerRow != 0 ) { |
345 | | - $s .= "\n\t</tr>"; |
346 | | - } |
347 | | - $s .= "\n</table>"; |
| 346 | + $s .= "\n</ul>"; |
348 | 347 | |
349 | 348 | return $s; |
350 | 349 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -213,6 +213,7 @@ |
214 | 214 | [[MediaWiki:Longpage-hint]] (empty per default) can be used instead. |
215 | 215 | Parameters: $1 shows the formatted textsize in Byte/KB/MB, $2 is the raw |
216 | 216 | number of the textsize in Byte |
| 217 | +* (bug 3276) Give image <gallery>s fluid width |
217 | 218 | |
218 | 219 | === Bug fixes in 1.17 === |
219 | 220 | * (bug 17560) Half-broken deletion moved image files to deletion archive |
Index: trunk/extensions/Cite/citeParserTests.txt |
— | — | @@ -110,15 +110,13 @@ |
111 | 111 | !! result |
112 | 112 | <p><sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup> |
113 | 113 | </p> |
114 | | -<table class="gallery" cellspacing="0" cellpadding="0"> |
115 | | - <tr> |
116 | | - <td><div class="gallerybox" style="width: 155px;"> |
| 114 | +<ul class="gallery"> |
| 115 | + <li class="gallerybox" style="width: 155px"><div style="width: 155px"> |
117 | 116 | <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
118 | 117 | <div class="gallerytext"> |
119 | 118 | </div> |
120 | | - </div></td> |
121 | | - </tr> |
122 | | -</table> |
| 119 | + </div></li> |
| 120 | +</ul> |
123 | 121 | <ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> one</li></ol> |
124 | 122 | |
125 | 123 | !! end |