Template:Multiple image: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Beyond My Ken
(Undid revision 382082382 by Thumperward (talk) Not rendering properly under IE)
meta>Waldyrious
(simplified code / improved readability / added some comments (tested on sandbox))
Line 1: Line 1:
{{#if:{{{image1|}}}{{{image2|}}}{{{image3|}}}{{{image4|}}}{{{image5|}}}{{{image6|}}}{{{image7|}}}{{{image8|}}}{{{image9|}}}{{{image10|}}}|<div class="thumb {{#switch: {{{align|}}} | left = tleft | center | centre = tnone | tright}}" style="width: {{#switch:{{{direction|}}}
{{#if:{{{image1|}}}{{{image2|}}}{{{image3|}}}{{{image4|}}}{{{image5|}}}{{{image6|}}}{{{image7|}}}{{{image8|}}}{{{image9|}}}{{{image10|}}}|<div class="thumb {{#switch: {{{align|}}} | left = tleft | center|centre = tnone | right|#default = tright}}" style="width: {{#switch:{{{direction|}}}<!--
| vertical   = {{#expr:{{#if:{{{width|}}}|{{{width}}}|{{max|{{{width1|}}}|{{max|{{max|{{{width2|}}}|{{{width3|}}}|{{{width4|}}}}}|{{max|{{{width5|}}}|{{{width6|}}}|{{{width7|}}}}}|{{max|{{{width8|}}}|{{{width9|}}}|{{{width10|}}}}}}}}}}}+12}}
If stacked vertically, box width = largest width + 12 px (6 px margin on left and right) -->
| horizontal
| vertical               = {{#expr: {{{width | {{Max/27 | {{{width1|}}} | {{{width2|}}} | {{{width3|}}} | {{{width4|}}} | {{{width5|}}} | {{{width6|}}} | {{{width7|}}} | {{{width8|}}} | {{{width9|}}} | {{{width10|}}} }} }}} +12 }}
| #default   = {{#if:{{{width|}}}|{{#expr:({{{width|0}}}+4)*{{#if:{{{image10|}}}|10|{{#if:{{{image9|}}}|9|{{#if:{{{image8|}}}|8|{{#if:{{{image7|}}}|7|{{#if:{{{image6|}}}|6|{{#if:{{{image5|}}}|5|{{#if:{{{image4|}}}|4|{{#if:{{{image3|}}}|3|2}}}}}}}}}}}}}}}}+8}}|{{#expr:16+{{{width1|0}}}+{{{width2|0}}}+{{{width3|0}}}+{{{width4|0}}}+{{{width5|0}}}+{{{width6|0}}}+{{{width7|0}}}+{{{width8|0}}}+{{{width9|0}}}+{{{width10|0}}}+{{#if:{{{image10|}}}|32|{{#if:{{{image9|}}}|28|{{#if:{{{image8|}}}|24|{{#if:{{{image7|}}}|20|{{#if:{{{image6|}}}|16|{{#if:{{{image5|}}}|12|{{#if:{{{image4|}}}|8|{{#if:{{{image3|}}}|4|0}}}}}}}}}}}}}}}}}}}}}}px; {{#switch: {{{align|}}} | center | centre = margin: 0 auto;}}{{#if:{{{background color|}}}|background-color: {{{background color}}} }}">
| horizontal | #default = {{#if:{{{width|}}}<!--
  If stacked horizontally and a single common width was passed for use in all images,
  box width = (common width + 4px) * number of images + 8.
  This creates a 4px margin between the images, and a 6px margin on each side -->
  |{{#expr:
      ({{{width}}}+4)
      *
      {{Template:Multiple image/numImgs | {{{image1|}}} | {{{image2|}}} | {{{image3|}}} | {{{image4|}}} | {{{image5|}}} | {{{image6|}}} | {{{image7|}}} | {{{image8|}}} | {{{image9|}}} | {{{image10|}}} }}
      +
      8
      }}<!--
  If stacked horizontally and a custom width was passed for each image,
  box width = sum of all widths + 4 pixels of margin between each pair of images + 16 pixels of margin (8 on each side of the box) (why not 6px as in other cases?...)-->
  |{{#expr:
      {{{width1|0}}}+{{{width2|0}}}+{{{width3|0}}}+{{{width4|0}}}+{{{width5|0}}}+{{{width6|0}}}+{{{width7|0}}}+{{{width8|0}}}+{{{width9|0}}}+{{{width10|0}}}
      +
      4 * ({{Template:Multiple image/numImgs | {{{image1|}}} | {{{image2|}}} | {{{image3|}}} | {{{image4|}}} | {{{image5|}}} | {{{image6|}}} | {{{image7|}}} | {{{image8|}}} | {{{image9|}}} | {{{image10|}}} }} - 2)
      +
      16
      }}
  }}
}}px; {{#switch: {{{align|}}} | center | centre = margin: 0 auto;}}{{#if:{{{background color|}}}|background-color: {{{background color}}} }}">
<div class="thumbinner" {{#if:{{{background color|}}}|style="background-color: {{{background color}}}"}}>
<div class="thumbinner" {{#if:{{{background color|}}}|style="background-color: {{{background color}}}"}}>
{{#if:{{{header|}}}|
{{#if:{{{header|}}}|

Revision as of 11:39, 8 September 2010