Difference between revisions of "Template:Event preview infobox"

From Tokyo Afterschool Summoners
Jump to navigation Jump to search
(Blanked the page)
 
(80 intermediate revisions by 3 users not shown)
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;
    overflow: visible;
    position: relative;
    display: inline-block;
}


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=
}}
}}{{#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;}}">
<tr>
  <th colspan="2">[[{{#var:event subobj}}|{{#var:event display name|?}}]]{{#if:{{#var:event display subtitle|}}|<br>~{{#var:event display subtitle|}}~}}</th>
</tr>
<tr>
  <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>
  </td>{{#arraydefine:banner image array|}}
</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|}}|
<tr>
  <th colspan="2">Durations</th>
</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
}}{{#while:|{{#var:duration loop}}|
{{#vardefine:duration array piece|
  {{#sub:{{#var:duration array}}|0|{{#pos:{{#var:duration array}}|;}}}}
}}{{#if:{{#var:duration array|}}|
{{#if:{{#pos:{{#var:duration array}}|!}}|
  {{#vardefine:duration array piece name|
    {{#explode:{{#var:duration array piece}}|!|0}}
  }}{{#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}}
  }}
  |{{#vardefine:duration array piece name|Duration
  }}{{#vardefine:duration array piece start|
    {{#explode:{{#var:duration array piece}}|->|0}}
  }}{{#vardefine:duration array piece end|
    {{#explode:{{#var:duration array piece}}|->|1}}
  }}{{#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}}}}
  }}
}}}}<tr>
{{#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>{{#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 end|{{#time:{{#var:duration format}}|{{#replace:{{#replace:{{#var:duration array piece end}}|@|}}|+09:00|+00:00}}}}
}}
<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}}|;}}||
  {{#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|???}}}}}}
}}{{#vardefine:duration earliest|{{#replace:{{#show:{{#var:event subobj}}|?Earliest duration}}|,|}}
}}{{#vardefine:duration latest|{{#replace:{{#show:{{#var:event subobj}}|?Latest duration}}|,|}}
}}{{#if:{{#var:duration earliest|}}|
  {{#if:{{#var:duration latest|}}|{{#vardefine:duration format|F d\, Y "at" H\:i}}
    {{#vardefine:duration primary|
      {{#time:{{#var:duration format}}|@{{#var:duration earliest}}}} until {{#time:{{#var:duration format}}|@{{#var:duration latest}}}}
    }}
  }}
}}{{#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 an event's information through an infobox.
== Usage ==
<pre>{{Event preview infobox
| en name =
| jp name =
| banners =
| floats =
| use jp =
}}</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.
; 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 ===
<pre>{{Event preview infobox
| en name = Advance! Onsen Jamboree
| banners = 2
}}
</pre>
{{Event preview infobox
| en name = Advance! Onsen Jamboree
| banners = 2
}}
[[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
}}