Template:EventCountdown: Difference between revisions
oldwiki>RiceEmpress (adding selfNullEdit - from here tweaks will be made to get it working like it did during testing) |
RiceEmpress (talk | contribs) (added documentation) |
||
| (13 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
<includeonly>{{#if: {{{countdown|}}} | <span class="countdown" data-options="short-format" style="display:none;" data-end="callback" data-callback="selfNullEdit">Starts: <span class="countdowndate">{{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}}</span></span> | Starts: {{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}} | <includeonly>{{#if: {{{countdown|}}} | <span class="countdown" data-options="short-format" style="display:none;" data-end="callback" data-callback="selfNullEdit">Starts: <span class="countdowndate">{{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}}</span></span> | Starts: {{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}} | ||
}}</includeonly> | }} | ||
{{#widget:CountdownTimer}} | |||
</includeonly> | |||
<noinclude> | <noinclude> | ||
This counts down the time until the recurrent event for a given style, and gives a differing output format depending on how many parameters are input.</noinclude> | This counts down the time until the recurrent event for a given style, and gives a differing output format depending on how many parameters are input. | ||
[[Template:EventCountdown|EventCountdown]] is the clock itself using the time defined in [[Template:EventTimeCountdownUnix|EventTimeCountdownUnix]]: | |||
<nowiki> | |||
{{#if: {{{countdown|}}} | <span class="countdown" data-options="short-format" style="display:none;" data-end="callback" data-callback="selfNullEdit">Starts: <span class="countdowndate">{{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}}</span></span> | Starts: {{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}| eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}} | |||
}} | |||
{{#widget:CountdownTimer}}</nowiki> | |||
Where the first "if: countdown" part makes sure the user requested a countdown (and if not, simply displays the date and time of the next event), and the time it counts down to is: <nowiki>{{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle| Attitude Mint}}}}} + {{#time:U|now}}}}}}</nowiki> | |||
This adds the time left until the next two-week marker to now, and tells the clock to count down to it. If nothing is defined, it decides the next style will be LUNATIC MAINFRAME. | |||
Example: | |||
<pre><nowiki> | |||
{{EventCountdown | |||
|eventstyle=Attitude Mint | |||
|cyclestart=2025-12-12 04:53 | |||
|countdown=true | |||
}} | |||
</nowiki></pre> | |||
Yields: | |||
{{EventCountdown|eventstyle=Attitude Mint|cyclestart=2025-12-12 04:53|countdown=true}} | |||
[[Category:Templates]] | |||
{{NOISZ Timer Flowchart}} | |||
</noinclude> | |||
Latest revision as of 20:28, 5 February 2026
This counts down the time until the recurrent event for a given style, and gives a differing output format depending on how many parameters are input.
EventCountdown is the clock itself using the time defined in EventTimeCountdownUnix:
{{#if: {{{countdown|}}} | <span class="countdown" data-options="short-format" style="display:none;" data-end="callback" data-callback="selfNullEdit">Starts: <span class="countdowndate">{{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}}</span></span> | Starts: {{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}| eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}}
}}
{{#widget:CountdownTimer}}
Where the first "if: countdown" part makes sure the user requested a countdown (and if not, simply displays the date and time of the next event), and the time it counts down to is: {{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle| Attitude Mint}}}}} + {{#time:U|now}}}}}}
This adds the time left until the next two-week marker to now, and tells the clock to count down to it. If nothing is defined, it decides the next style will be LUNATIC MAINFRAME.
Example:
{{EventCountdown
|eventstyle=Attitude Mint
|cyclestart=2025-12-12 04:53
|countdown=true
}}
Yields:
Timer Templates