Difference between revisions of "Template:Event infobox"

438 bytes removed ,  17:45, 25 April 2021
no edit summary
 
(80 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#css:
<includeonly>{{#if: {{NAMESPACE}} | <!-- don't create subobj within namespace --> |
table.infobox {
{{ #if: {{{id|}}} | {{#masterdata:Event|{{{id|}}} }} }}{{#vardefine:is active|{{#ifeq:{{{active|}}}|true|true|{{#ifeq:{{{active|}}}|false|false|}}}}
    background-color: #f9f9f9;
}}{{#vardefine:duration array|{{{duration|{{#var:event duration|}}}}}{{#vardefine:duration|}}
    border: 1px solid #aaa;
}}{{#if:{{{duration|{{#var:event duration|}}}}}|
    font-size: 11px;
  {{#vardefine:duration loop|1
     margin: 1em 0em 1em 2em;
}}{{#while:|{{#var:duration loop}}|
    padding: 2px;
{{#vardefine:duration array piece|
     text-align: center;
  {{#sub:{{#var:duration array}}|0|{{#pos:{{#var:duration array}}|;}}}}
    width: 250px;
}}{{#if:{{#var:duration array|}}|
    float: right;
  {{#if:{{#pos:{{#var:duration array}}|!}}|
     overflow: visible;
     {{#vardefine:duration array piece name|
    position: relative;
      {{#explode:{{#var:duration array piece}}|!|0}}
    width: 250px;
     }}{{#vardefine:duration array piece start|
}
      {{#explode:
 
        {{#explode:{{#var:duration array piece}}|!|1
table.infobox th {
      }}|->|0}}
     padding: 0em 1em 0em 1em;
     }}{{#vardefine:duration array piece end|
}
      {{#explode:
 
        {{#explode:{{#var:duration array piece}}|!|1
table.infobox tr:first-child th {
      }}|->|1}}
     background-color: #ccf;
    }}
     padding: 0.5em 1em 0.5em 1em;
    |{{#vardefine:duration array piece name|Duration
     font-size: 1.2em;
     }}{{#vardefine:duration array piece start|
}
      {{#explode:{{#var:duration array piece}}|->|0}}
 
    }}{{#vardefine:duration array piece end|
table.infobox tr:not(:first-child) th {
      {{#explode:{{#var:duration array piece}}|->|1}}
     background-color: #ddf;
    }}{{#if:{{#var:duration array piece start|}}||{{#vardefine:duration array piece start|{{#time:c|December 2nd, 2016}}}}
}
     }}{{#if:{{#var:duration array piece end|}}||{{#vardefine:duration array piece end|{{#time:c|December 31st, 3000}}}}
 
     }}
table.infobox tr:not(:first-child) th + th {
  }}{{#vardefine:duration array piece start|{{#replace:{{#var:duration array piece start}}|@|}}
     background-color: #e4e4ff;
     }}{{#vardefine:duration array piece end|{{#replace:{{#var:duration array piece end}}|@|}}
}
  }}{{#if:{{#var:duration}}|
 
    {{#vardefine:duration|{{#var:duration}};{{#var:duration array piece name}}!{{#replace:{{#time:c|{{#var:duration array piece start}}}}|+00:00|+09:00}}->{{#replace:{{#time:c|{{#var:duration array piece end}}}}|+00:00|+09:00}}}}
table.infobox td {
     |{{#vardefine:duration|{{#var:duration array piece name}}!{{#replace:{{#time:c|{{#var:duration array piece start}}}}|+00:00|+09:00}}->{{#replace:{{#time:c|{{#var:duration array piece end}}}}|+00:00|+09:00}}}}
    text-align: left;
  }}{{#ifexpr:{{#time: U|now}} >= {{#time:U|{{#var:duration array piece start}}}} and {{#time: U|now}} <= {{#time: U|{{#var:duration array piece end}}}}|
    padding: 0px 7px 0px 7px;
     <!--{{#vardefine:is active|true}}-->
}
  }}{{#vardefine:duration array piece start|{{#time:U|{{#var:duration array piece start}}}}
}}{{#if: {{NAMESPACE}} | <!-- don't create subobj within namespace --> | {{#subobject:event{{#vardefineecho:eventnumber|{{#expr:{{#var:eventnumber|-1}}+1}}}}
  }}{{#vardefine:duration array piece end|{{#time:U|{{#var:duration array piece end}}}}
  }}{{#ifexpr:{{#var:duration array piece start}} <= {{#var:duration earliest start|{{#time:U|December 31, 3000}}}}|{{#vardefine:duration earliest start|{{#var:duration array piece start}}}}
  }}{{#ifexpr:{{#var:duration array piece end}} >= {{#var:duration latest end|{{#time:U|December 2nd, 2016}}}}|{{#vardefine:duration latest end|{{#var:duration array piece end}}}}
  }}
}}{{#if:{{#pos:{{#var:duration array}}|;}}||
  {{#vardefine:duration loop|}}
}}{{#vardefine:duration array|
  {{#sub:{{#var:duration array}}|{{#expr:{{#pos:{{#var:duration array}}|;}}+1}}}}
}}
}}}}{{#ifeq:{{#var:is active|false}}|true||{{#vardefine:is active|false}}}}{{#subobject:event{{#vardefineecho:eventnumber|{{#expr:{{#var:eventnumber|-1}}+1}}}}
| Has game context = Event
| Has game context = Event
| Has Japanese name ={{{jp name|}}}
| Has Japanese name ={{{jp name|}}}
| Has English name ={{{en name|}}}
| Has English name ={{{en name|}}}
| Has news link = {{{news link|}}}
| Has lowercase English name ={{lc:{{{en name|}}}}}
| Has English subtitle = {{{en subtitle|}}}
| Has Japanese subtitle = {{{jp subtitle|}}}
| Has news link = {{#ifeq:{{#var:is active|}}|true||https://web.archive.org/web/*/|}}{{{news link|}}}
| Has banner image = {{{banner image|}}}
| Has banner image = {{{banner image|}}}
| Has start date = {{{starts|}}}
| Has duration date = {{#var:duration|{{{duration|{{#var:event duration|}}}}}}}
| Has end date = {{{ends|}}}
| Has event type = {{{type|Time-Limited}}}
| Has type = {{{type|Time-Limited}}}
| Earliest duration = {{#var:duration earliest start}}
}}
| Latest duration = {{#var:duration latest end}}
| Is active = {{#var:is active}}
| Has ID = {{{id|}}}
| Has filename = {{#var:event filename|}}
}}{{#ifeq:{{#var:is active|false}}|true|[[Category:Active events]]|[[Category:Inactive events]]}}
}}<!-- end subobject
}}<!-- end subobject
--><table id="event{{#eventnumber}}" class="infobox">
-->{{Event preview infobox
<tr>
| en name = {{{en name|}}}
  <th colspan="2">{{{en name|{{{jp name|???}}}}}}</th>
| jp name = {{{jp name|}}}
</tr>
| floats = true
<tr>
| banners = 0
  <td colspan="2">{{#vardefine:banner image array|{{{banner image|}}}}}{{#vardefine:banner image loop|1}}{{#while:|{{#var:banner image loop}}|
| show news link = yes
[[File:{{#sub:{{#var:banner image array}}|0|{{#pos:{{#var:banner image array}}|;}}}}|400px]]
}}</includeonly><noinclude>{{Documentation}}</noinclude>
{{#if:{{#pos:{{#var:banner image array}}|;}}||{{#vardefine:banner image loop|}}}}
{{#vardefine:banner image array|{{#sub:{{#var:banner image array}}|{{#expr:{{#pos:{{#var:banner image array}}|;}}+1}}}}}}
}}
  </td>
</tr>
<tr>
  <th colspan="2">Durations</th>
</tr>
{{#vardefine:duration start array|{{{starts|}}}}}{{#vardefine:duration end array|{{{ends|}}}}}{{#vardefine:duration loop|1}}{{#while:|{{#var:duration loop}}|
{{#vardefine:duration start array piece|{{#sub:{{#var:duration start array}}|0|{{#pos:{{#var:duration start array}}|;}}}}}}{{#vardefine:duration end array piece|{{#sub:{{#var:duration end array}}|0|{{#pos:{{#var:duration end array}}|;}}}}}}
<tr>
<td>{{#explode:{{#var:duration start array piece}}|:|0}}</td>
<td>{{#explode:{{#var:duration start array piece}}|:|1}} -> {{#explode:{{#var:duration end array piece}}|:|1}}</td>
</tr>
{{#if:{{#pos:{{#var:duration start array}}|;}}||{{#vardefine:duration loop|}}}}{{#vardefine:duration start array|{{#sub:{{#var:duration start array}}|{{#expr:{{#pos:{{#var:duration start array}}|;}}+1}}}}}}{{#vardefine:duration end array|{{#sub:{{#var:duration end array}}|{{#expr:{{#pos:{{#var:duration end array}}|;}}+1}}}}}}
}}
</table></includeonly><noinclude>
== Description ==
 
This templates creates an infobox for an event, as well as an event subobject using the following properties:
 
* Has Japanese name
* Has English name
* Has news link
* Has banner image
* Has start date
* Has end date
* Has type
 
== Usage ==
<pre>{{Event infobox
| jp name =
| en name =  
| news link =
| banner image =
| starts =
| ends =
| type =
}}</pre>
 
=== Parameters ===
 
; jp name : Japanese name.
; en name : Translated name, official if jp-en name exists, unofficial if not.
; jp-en name : Unofficial translated name.
; news link : Link to the news post from housamo.info
; banner image : Image(s) for the banners present during the event; separate multiple images using a semicolon.
; starts : The start date(s); separate multiples using a semicolon. Name using a colon. Please use an ISO-8601 friendly timestamp.
; ends : The end date(s); separate multiples using a semicolon. Name using a colon. Please use an ISO-8601 friendly timestamp.
; type : The type of event: Time-Limited if non-event (no event shop, etc.), Full if true event; defaults to Time-Limited
 
== Examples ==
 
<pre>{{Event infobox
| jp name = オリエント・ニューイヤー!
| en name = Oriental New Year!
| news link = https://web.archive.org/web/20180104052030/http://lifewonders2.sakura.ne.jp/wp/newyear2018/
| banner image = 1801お正月-小バナー1-2.png
| starts = Quest:January 4th, 2018;Gacha:January 4th, 2018
| ends = Quest:January 20th, 2018;Gacha:January 27th, 2018
| type = Limited-Time
}}
</pre>
{{Event infobox
| jp name = オリエント・ニューイヤー!
| en name = Oriental New Year!
| news link = https://web.archive.org/web/20180104052030/http://lifewonders2.sakura.ne.jp/wp/newyear2018/
| banner image = 1801お正月-小バナー1-2.png
| starts = Quest:January 4th, 2018;Gacha:January 4th, 2018
| ends = Quest:January 20th, 2018;Gacha:January 27th, 2018
| type = Limited-Time
}}
 
[[Category:Infobox templates]][[Category:Subobject templates]]
</noinclude>