Difference between revisions of "Template:Countdown"

From Dragalia Lost Wiki
Jump to navigation Jump to search
>Teg
(Created page with "<includeonly>{{#ifexpr: {{#vardefineecho:daysLeft|{{#expr:floor(({{#time:U|{{{1|}}}}} - {{#time:U|now}}) / 86400)}}}} > 0 | Days left: {{#var:daysLeft}} |}} <!-- -->...")
 
>Caledor92
m
 
(62 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly>{{#ifexpr: {{#vardefineecho:daysLeft|{{#expr:floor(({{#time:U|{{{1|}}}}} - {{#time:U|now}}) / 86400)}}}} > 0 | Days left: {{#var:daysLeft}} |}} <!--
+
<includeonly><div>{{#ifexpr:{{#time:U|now}}<{{#time:U|{{#time:F d, Y h:i:s A e|{{{TimeStart|Now}}}}}}}|Begins in: <span data-options="no-leading-zeros short-format" data-end="toggle" data-toggle=".post-countdown1{{{EventName}}}" class="countdown" style="display:none;"><span class="countdowndate" style="font-weight:bold">{{#time:F d, Y h:i:s A e|{{{TimeStart}}}}}</span></span><span class="post-countdown1{{{EventName}}}" style="display:none;">Event has started. <small>[{{fullurl:{{FULLPAGENAME}}|action=purge}} Purge page]</small></span>|Ends in: <span data-options="no-leading-zeros short-format" data-end="toggle" data-toggle=".post-countdown2{{{EventName}}}" class="countdown" style="display:none;"><span class="countdowndate" style="font-weight:bold">{{#time:F d, Y h:i:s A e|{{{TimeEnd}}}}}</span></span><span class="post-countdown2{{{EventName}}}" style="display:none;">Event has concluded. <small>[{{fullurl:{{FULLPAGENAME}}|action=purge}} Purge page]</small></span>}}</div></includeonly>
          -->{{#ifexpr: {{#time:U|now + 1 day}} > {{#time:U|{{{1|}}}}} and {{#time:U|now + 1 hour}} < {{#time:U|{{{1|}}}}} | Hrs. left: {{padleft:{{#expr:floor(({{#time:U|{{{1|}}}}} - {{#time:U|now}}) mod 86400 / 3600)}}}}|}} <!--
+
<noinclude>(Countdown) - Parses EventName, TimeStart and TimeEnd into a countdown, mostly used on [[event]] mentioning pages.
          -->{{#ifexpr: {{#time:U|now + 1 hour}} > {{#time:U|{{{1|}}}}} | Mins. left: {{padleft:{{#expr:ceil(({{#time:U|{{{1|}}}}} - {{#time:U|now}}) mod 3600 / 60)}}}} | }}</includeonly>
+
 
 +
This template works with a JavaScript snippet that can be found either in this wiki's common.js or a gadget. It does NOT use the countdown extension.
 +
 
 +
*Each EventName must be unique, or the countdown end message will display for all countdowns once one TimeEnd is reached.
 +
*When TimeStart has been reached, the countdown will show "Event has started" and provide a link to purge the page (the user can alternatively refresh).
 +
*If |TimeStart is not included in the template call, the template will automatically use Now as a placeholder time, and will skip the Time Until Start portion and go into the Time remaining portion.
 +
[[Category:Templates]]</noinclude>

Latest revision as of 13:40, 21 November 2019

(Countdown) - Parses EventName, TimeStart and TimeEnd into a countdown, mostly used on event mentioning pages.

This template works with a JavaScript snippet that can be found either in this wiki's common.js or a gadget. It does NOT use the countdown extension.

  • Each EventName must be unique, or the countdown end message will display for all countdowns once one TimeEnd is reached.
  • When TimeStart has been reached, the countdown will show "Event has started" and provide a link to purge the page (the user can alternatively refresh).
  • If |TimeStart is not included in the template call, the template will automatically use Now as a placeholder time, and will skip the Time Until Start portion and go into the Time remaining portion.