Difference between revisions of "Template:Event preview infobox"

From Tokyo Afterschool Summoners
Jump to navigation Jump to search
 
(15 intermediate revisions by 2 users not shown)
Line 10: Line 10:
     position: relative;
     position: relative;
     display: inline-block;
     display: inline-block;
}
td > .banner-image > a > img {
    padding: 0px;
    width: 425px;
}
}


Line 39: Line 34:
     padding: 0px 7px 0px 7px;
     padding: 0px 7px 0px 7px;
}
}
}}{{#vardefine:duration array|}}{{#vardefine:event subobj|
}}{{#vardefine:event subobj|
  {{#ask:
  {{#ask:
   [[Has game context::Event]]
   [[Has game context::Event]]
Line 49: Line 44:
   |searchlabel=
   |searchlabel=
  }}
  }}
}}{{#vardefine:event display name|
{{#show:{{#var:event subobj}}|?Has English name}}
}}{{#ifeq:{{#var:event display name|}}||
{{#vardefine:event display name|
{{#show:{{#var:event subobj}}|?Has Japanese name}}
}}
}}
{{#vardefine:event display subname|
{{#show:{{#var:event subobj}}|?Has English subtitle}}
}}{{#ifeq:{{#var:event display subname|}}||
{{#vardefine:event display subname|
{{#show:{{#var:event subobj}}|?Has Japanese subtitle}}
}}
}}{{#ifeq:{{#var:event display id|}}||
{{#vardefine:event display id|
{{#show:{{#var:event subobj}}|?Has ID}}
}}
}}{{#ifeq:{{#var:event display filename|}}||
{{#vardefine:event display filename|
{{#show:{{#var:event subobj}}|?Has filename}}
}}
}}{{#if:{{#var:event subobj}}|<table id="event{{#eventnumber}}" class="preview-infobox" style="{{#ifeq:{{{floats|false}}}|true|float: right;}}">
}}{{#if:{{#var:event subobj}}|<table id="event{{#eventnumber}}" class="preview-infobox" style="{{#ifeq:{{{floats|false}}}|true|float: right;}}">
<tr>
<tr>
   <th colspan="2">[[{{#var:event subobj}}|{{#ifeq:{{{use jp|false}}}|{{{en name|false}}}|
   <th colspan="2">[[{{#var:event subobj}}|{{#var:event display name|?}}]]{{#if:{{#var:event display subtitle|}}|<br>~{{#var:event display subtitle|}}~}}</th>
  {{#show:{{#var:event subobj}}|?Has English name}}|{{#ifeq:{{{use jp|}}}|{{{jp name|true}}}|
  {{#show:{{#var:event subobj}}|?Has Japanese name}}|{{{en name|{{{jp name|???}}}}}}}}
}}]]{{#vardefine:event subtitle|{{#ifeq:{{{use jp|false}}}|{{{en name|false}}}|
  {{#show:{{#var:event subobj}}|?Has English subtitle}}|{{#ifeq:{{{use jp|}}}|{{{jp name|true}}}|
  {{#show:{{#var:event subobj}}|?Has Japanese subtitle}}}}
}}}}{{#if:{{#var:event subtitle|}}|<br>~{{#var:event subtitle|}}~}}</th>
</tr>
</tr>
<tr>
<tr>
   <td colspan="2">{{#vardefine:banner image array|{{#show:{{#var:event subobj}}|?Has banner image}}}}{{#vardefine:banner image loop|{{#ifeq:{{{banners|1}}}|0|999|{{{banners|1}}}}}}}{{#while:|{{#var:banner image loop}}|
   <td colspan="2">{{#arraydefine:banner image array|{{#show:{{#var:event subobj}}|?Has banner image}}|;}}<div class="banner-image">{{#arrayprint:banner image array|<br>|@@@@@|[[File:@@@@@|link={{#var:event subobj}}|425px|center]]}}</div>
<div class="banner-image">{{Direct Linked Image|src={{filepath:{{#sub:{{#var:banner image array}}|0|{{#pos:{{#var:banner image array}}|;}}}}}}|href={{#show:{{#var:event subobj}}|?Has news link}}}}<!--<a href="{{#show:{{#var:event subobj}}|?Has news link}}"><img class="banner-image" src="{{filepath:{{#sub:{{#var:banner image array}}|0|{{#pos:{{#var:banner image array}}|;}}}}}}"></img></a>--></div>
  </td>{{#arraydefine:banner image array|}}
{{#if:{{#pos:{{#var:banner image array}}|;}}|{{#vardefine:banner image loop|{{#expr:{{#var:banner image loop}}-1}}}}|{{#vardefine:banner image loop|}}}}
{{#vardefine:banner image array|{{#sub:{{#var:banner image array}}|{{#expr:{{#pos:{{#var:banner image array}}|;}}+1}}}}}}
}}
  </td>
</tr>
</tr>
{{#if:{{{show news link|}}}|<!--<tr>
  <td>[{{#show:{{#var:event subobj}}|?Has news link}} News link]</td>
</tr>--><tr>
  <th colspan="2">[{{#show:{{#var:event subobj}}|?Has news link}} News Link]</th>
</tr>}}
{{#vardefine:duration array|{{#show:{{#var:event subobj}}|?Has duration date}}}}{{#if:{{#var:duration array|}}|
{{#vardefine:duration array|{{#show:{{#var:event subobj}}|?Has duration date}}}}{{#if:{{#var:duration array|}}|
<tr>
<tr>
   <th colspan="2">Durations</th>
   <th colspan="2">Durations</th>
</tr>
</tr>
{{#if:{{#var:event display id|}}|
<tr>
  <th colspan="2">Event ID: {{#var:event display id|}}</th>
</tr>
<tr>
  <th colspan="2">Event Filename: {{#var:event display filename|}}</th>
</tr>
}}
{{#vardefine:duration loop|1
{{#vardefine:duration loop|1
}}{{#while:|{{#var:duration loop}}|
}}{{#while:|{{#var:duration loop}}|
Line 99: Line 118:
{{#vardefine:duration array tag|{{#ifexpr:{{#time: U|now}} >= {{#time:U|{{#var:duration array piece start}}}} and {{#time: U|now}} <= {{#time: U|{{#var:duration array piece end}}}}|b|s}}}}
{{#vardefine:duration array tag|{{#ifexpr:{{#time: U|now}} >= {{#time:U|{{#var:duration array piece start}}}} and {{#time: U|now}} <= {{#time: U|{{#var:duration array piece end}}}}|b|s}}}}
<td><{{#var:duration array tag}}>{{#explode:{{#var:duration array piece}}|!|0}}</{{#var:duration array tag}}>
<td><{{#var:duration array tag}}>{{#explode:{{#var:duration array piece}}|!|0}}</{{#var:duration array tag}}>
</td>{{#vardefine:duration format|F d\, Y "at" H\:i}}
</td>{{#vardefine:duration format|F d\, Y H\:i}}
{{#vardefine:duration array piece start|{{#time:{{#var:duration format}}|{{#replace:{{#replace:{{#var:duration array piece start}}|@|}}|+09:00|+00:00}}}}
{{#vardefine:duration array piece start|{{#time:{{#var:duration format}}|{{#replace:{{#replace:{{#var:duration array piece start}}|@|}}|+09:00|+00:00}}}}
   }}{{#vardefine:duration array piece end|{{#time:{{#var:duration format}}|{{#replace:{{#replace:{{#var:duration array piece end}}|@|}}|+09:00|+00:00}}}}
   }}{{#vardefine:duration array piece end|{{#time:{{#var:duration format}}|{{#replace:{{#replace:{{#var:duration array piece end}}|@|}}|+09:00|+00:00}}}}
}}
}}
<td>From {{#var:duration array piece start|?}} until {{#var:duration array piece end|?}}</td>
<td>{{#var:duration array piece start|?}} to {{#var:duration array piece end|?}}</td>
</tr>{{#if:{{#varexists:duration primary}}||{{#vardefine:duration primary|{{#var:duration array piece start}} until {{#var:duration array piece end}}}}}}{{#if:{{#pos:{{#var:duration array}}|;}}||
</tr>{{#if:{{#varexists:duration primary}}||{{#vardefine:duration primary|{{#var:duration array piece start}} until {{#var:duration array piece end}}}}}}{{#if:{{#pos:{{#var:duration array}}|;}}||
   {{#vardefine:duration loop|}}
   {{#vardefine:duration loop|}}
Line 143: Line 162:
=== Examples ===
=== Examples ===
<pre>{{Event preview infobox
<pre>{{Event preview infobox
| en name = Honorless Great Summer Festival Struggle
| en name = Advance! Onsen Jamboree
| banners = 2
| banners = 2
}}
}}
</pre>
</pre>
{{Event preview infobox
{{Event preview infobox
| en name = Honorless Great Summer Festival Struggle
| en name = Advance! Onsen Jamboree
| banners = 2
| banners = 2
}}
}}
[[Category:Formatting templates]]</noinclude>
[[Category:Formatting templates]]</noinclude>

Latest revision as of 17:38, 25 April 2021

Description

This template displays an event's information through an infobox.

Usage

{{Event preview infobox
| en name = 
| jp name =
| banners = 
| floats =
| use jp =
}}

Parameters

en name
English name of event
jp name
Japanese name of event (optional if en name is provided; required if not).
banners
Number of banners to show; defaults to 1. Provide 0 to show all.
floats
Determines if it should float to the right; only "true" enables it.
use jp
For the title: uses the JP name if en name is provided if true; uses the EN name if jp name is provided if false.

Examples

{{Event preview infobox
| en name = Advance! Onsen Jamboree
| banners = 2
}}