Difference between revisions of "Template:Event preview infobox"

From Tokyo Afterschool Summoners
Jump to navigation Jump to search
(Blanked the page)
Line 1: Line 1:
<includeonly>{{#css:
table.preview-infobox {
    background-color: #f9f9f9;
    border: 1px solid #aaa;
    font-size: 11px;
    margin: 1em 0em 1em 2em;
    padding: 2px;
    text-align: center;
    width: 250px;
    {{#ifeq:{{{floats|false}}}|true|float: right;}}
    overflow: visible;
    position: relative;
    width: 250px;
}


td > .banner-image {
    padding: 0px;
    margin: -7px -7px 0px -7px;
}
table.preview-infobox th {
    padding: 0em 1em 0em 1em;
}
table.preview-infobox tr:first-child th {
    background-color: #ccf;
    padding: 0.5em 1em 0.5em 1em;
    font-size: 1.2em;
}
table.preview-infobox tr:not(:first-child) th {
    background-color: #ddf;
}
table.preview-infobox tr:not(:first-child) th + th {
    background-color: #e4e4ff;
}
table.preview-infobox td {
    text-align: left;
    padding: 0px 7px 0px 7px;
}
}}{{#vardefine:event subobj|
{{#ask:
  [[Has game context::Event]]
  {{#if:{{{en name|}}}|[[Has English name::~{{{en name}}}]]}}
  {{#if:{{{jp name|}}}|[[Has Japanese name::{{{jp name}}}]]}}
  |link=none
  |limit=1
  |headers=hide
  |searchlabel=
}}
}}{{#if:{{#var:event subobj}}|<table id="event{{#eventnumber}}" class="preview-infobox">
<tr>
  <th colspan="2">[[{{#var:event subobj}}|{{{en name|{{{jp name|???}}}}}}]]</th>
</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}}|
<div class="banner-image">[[File:{{#sub:{{#var:banner image array}}|0|{{#pos:{{#var:banner image array}}|;}}}}|400px|link={{#show:{{#var:event subobj}}|?Has news link}}]]</div>
{{#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>
  <th colspan="2">Durations</th>
</tr>
{{#vardefine:duration array|{{#show:{{#var:event subobj}}|?Has duration date}}}}{{#vardefine:duration loop|1}}{{#vardefine:duration loop|1}}{{#while:|{{#var:duration loop}}|
{{#vardefine:duration array piece|{{#sub:{{#var:duration array}}|0|{{#pos:{{#var:duration array}}|;}}}}}}{{#vardefine:duration array piece start|{{#explode:{{#explode:{{#var:duration array piece}}|!|1}}|->|0}}}}{{#vardefine:duration array piece end|{{#explode:{{#explode:{{#var:duration array piece}}|!|1}}|->|1}}}}
<tr>
{{#vardefine:duration array tag|{{#ifexpr:{{#time: U|now}}>{{#time: U|{{#replace:{{#var:duration array piece start}}|@|}}}} and {{#time: U|now}}<{{#time: U|{{#replace:{{#var:duration array piece end}}|@|}}}}|b|s}}}}
<td><{{#var:duration array tag}}>{{#explode:{{#var:duration array piece}}|!|0}}</{{#var:duration array tag}}>
</td>
<td>From {{#var:duration array piece start}} until {{#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}}|;}}||{{#vardefine:duration loop|}}}}{{#vardefine:duration array|{{#sub:{{#var:duration array}}|{{#expr:{{#pos:{{#var:duration array}}|;}}+1}}}}}}
}}
</table>
}}{{#ifeq:{{PAGENAME}}|Main Page|{{#if:{{#varexists:main page seo}}||{{#vardefine:main page seo|{{{en name|{{{jp name|???}}}}}}}}{{#seo:
|description=A wiki for Tokyo Afterschool Summoners&#10;Current Event: {{#var:main page seo}}{{#varexists:duration primary|&#10;From {{#var:duration primary}}.}}
}}}}}}</includeonly><noinclude>
== Description ==
This template displays.
== Usage ==
<pre>{{Event preview infobox
| en name =
| jp name =
| banners =
| floats =
}}</pre>
=== 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.
=== Examples ===
<pre>{{Event preview infobox
| en name = Honorless Great Summer Festival Struggle
| banners = 2
}}
</pre>
{{Event preview infobox
| en name = Honorless Great Summer Festival Struggle
| banners = 2
}}
[[Category:Formatting templates]]</noinclude>

Revision as of 16:11, 13 July 2018