跳转到内容

模板:Timer:修订间差异

来自DJMAX中文资料库
创建页面,内容为“<includeonly><div style="{{{style|text-align:center;font-size:18px;font-weight:bold;color:red;margin:0px 0px 10px 0px}}};{{{extra_style|}}}"> <span class="countdown" data-options="no-leading-zeros;{{#if:{{{short|}}}|short-format}}" {{#if:{{{countup|}}}||data-end="toggle" data-toggle=".{{{class|{{{endClass|countdownComplete{{{2|1}}}}}}}}}"}} style="display:none"> <span class="countdowndate">{{{1|{{{time|}}}}}}</span> {{#if:{{{countup|}}}|{{{text|{{{endText|}}}}}…”
 
无编辑摘要
 
(未显示同一用户的3个中间版本)
第1行: 第1行:
<includeonly><div style="{{{style|text-align:center;font-size:18px;font-weight:bold;color:red;margin:0px 0px 10px 0px}}};{{{extra_style|}}}">
<includeonly><div style="{{{style|text-align:center;}}};{{{extra_style|}}}">
<span class="countdown" data-options="no-leading-zeros;{{#if:{{{short|}}}|short-format}}" {{#if:{{{countup|}}}||data-end="toggle" data-toggle=".{{{class|{{{endClass|countdownComplete{{{2|1}}}}}}}}}"}} style="display:none">
<span class="countdown" data-options="no-leading-zeros;{{#if:{{{short|}}}|short-format}}" {{#if:{{{countup|}}}||data-end="toggle" data-toggle=".{{{class|{{{endClass|countdownComplete{{{2|1}}}}}}}}}"}} style="display:none">
<span class="countdowndate">{{{1|{{{time|}}}}}}</span> {{#if:{{{countup|}}}|{{{text|{{{endText|}}}}}}}}
<span class="countdowndate">{{{1|{{{time|}}}}}}</span> {{#if:{{{countup|}}}|{{{text|{{{endText|}}}}}}}}
</span>{{#if:{{{countup|}}}||
</span>{{#if:{{{countup|}}}||
<span class="{{{class|{{{endClass|countdownComplete{{{2|1}}}}}}}}}" style="display:none">{{{text|{{{endText|Countdown complete!}}}}}}</span>}}
<span class="{{{class|{{{endClass|countdownComplete{{{2|1}}}}}}}}}" style="display:none">{{{text|{{{endText|计时结束}}}}}}</span>}}
</div></includeonly><noinclude>
</div></includeonly><noinclude>
显示一个倒计时。
显示一个倒计时。
第9行: 第9行:
* <code>time</code> 或 <code>[1]</code> : 一个[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse 时间],必要。
* <code>time</code> 或 <code>[1]</code> : 一个[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse 时间],必要。
* <code>countup</code> : 布尔值。如果设定时间已过,则正数计时。会覆盖<code>class</code> & <code>[2]</code>的效果。
* <code>countup</code> : 布尔值。如果设定时间已过,则正数计时。会覆盖<code>class</code> & <code>[2]</code>的效果。
* <code>short</code> : 布尔值。时间显示为字母样式,如“天”显示“d”。
* <code>class</code> : 当同一页面有多个计时器时区别使用。比如,第一个计时器默认为 <code>countdownComplete1</code>,第二个计时器为<code>countdownComplete2</code>,等等。
* <code>class</code> : 当同一页面有多个计时器时区别使用。比如,第一个计时器默认为 <code>countdownComplete1</code>,第二个计时器为<code>countdownComplete2</code>,等等。
** <code>[2]</code> : 可以是任何一个数字,比如 <code>2</code> 是第二个计时器。
** <code>[2]</code> : 可以是任何一个数字,比如 <code>2</code> 是第二个计时器。
* <code>text</code> : 可选文本,默认为 <code>计时结束!</code> 。在 <code>countup</code> 计时结束后使用。
* <code>text</code> : 可选文本,默认为 <code>计时结束</code> 。在 <code>countup</code> 计时结束后使用。
* <code>style</code> : 自定义格式,可选。
* <code>style</code> : 自定义格式,可选。
* <code>extra_style</code> : 默认风格之外的其他CSS格式,可选。
* <code>extra_style</code> : 默认风格之外的其他CSS格式,可选。
第22行: 第21行:
{{Timer|January 1 2023 00:00:00 +0900|extra_style = text-align:left}}
{{Timer|January 1 2023 00:00:00 +0900|extra_style = text-align:left}}
<pre>
<pre>
{{Timer|January 1 2030 00:00:00 +0900|2|style = font-style:italic|text = Not yet.}}
{{Timer|January 1 2030 00:00:00 +0900|2|style = font-style:italic|text = 还没到。}}
</pre>
</pre>
{{Timer|January 1 2030 00:00:00 +0900|2|style = font-style:italic|text = Not yet.}}
{{Timer|January 1 2030 00:00:00 +0900|2|style = font-style:italic|text = 还没到。}}
<pre>
<pre>
{{Timer|January 19 2038 12:14:07 +0900|3|style = font-weight:bold|text = The time is now!}}
{{Timer|January 19 2038 12:14:07 +0900|3|style = font-weight:bold|text = 就是现在!}}
</pre>
</pre>
{{Timer|January 19 2038 12:14:07 +0900|3|style = font-weight:bold|text = The time is now!}}
{{Timer|January 19 2038 12:14:07 +0900|3|style = font-weight:bold|text = 就是现在!}}
<pre>
 
{{Timer|January 29 2042 12:17:04 +0900|3|style = font-weight:bold|short=true|text = The time is now short!}}
</pre>
{{Timer|January 29 2042 12:17:04 +0900|3|style = font-weight:bold|short=true|text = The time is now short!}}
==countup 示例==
==countup 示例==
<pre>
<pre>
第39行: 第35行:
{{Timer|January 1 2020 00:00:00 +0900|countup=true|extra_style = text-align:left}}
{{Timer|January 1 2020 00:00:00 +0900|countup=true|extra_style = text-align:left}}
<pre>
<pre>
{{Timer|January 1 1980 00:00:00 +0900|countup=true|style = font-style:italic|text = ago}}
{{Timer|January 1 1980 00:00:00 +0900|countup=true|style = font-style:italic|text = 之前}}
</pre>
{{Timer|January 1 1980 00:00:00 +0900|countup=true|style = font-style:italic|text = ago}}
<pre>
{{Timer|January 1 1970 00:00:00 +0900|countup=true|style = font-weight:bold|short=true|text = in the past}}
</pre>
</pre>
{{Timer|January 1 1970 00:00:00 +0900|countup=true|style = font-weight:bold|short=true|text = in the past}}
{{Timer|January 1 1980 00:00:00 +0900|countup=true|style = font-style:italic|text = 之前}}
 
<pre>
<pre>
{{Timer|January 19 2038 12:14:07 +0900|countup=true|style = font-weight:bold|text =. Still counts down normally for future dates.}}
{{Timer|January 19 2038 12:14:07 +0900|countup=true|style = font-weight:bold|text =。对未来时间依然会正数计时。}}
</pre>
</pre>
{{Timer|January 19 2038 12:14:07 +0900|countup=true|style = font-weight:bold|text =. Still counts down normally for future dates.}}
{{Timer|January 19 2038 12:14:07 +0900|countup=true|style = font-weight:bold|text =。对未来时间依然会正数计时。}}
</noinclude>
</noinclude>

2025年10月5日 (日) 17:43的最新版本

显示一个倒计时。

变量

  • time[1] : 一个时间,必要。
  • countup : 布尔值。如果设定时间已过,则正数计时。会覆盖class & [2]的效果。
  • class : 当同一页面有多个计时器时区别使用。比如,第一个计时器默认为 countdownComplete1,第二个计时器为countdownComplete2,等等。
    • [2] : 可以是任何一个数字,比如 2 是第二个计时器。
  • text : 可选文本,默认为 计时结束 。在 countup 计时结束后使用。
  • style : 自定义格式,可选。
  • extra_style : 默认风格之外的其他CSS格式,可选。

JS补充细节请参考MediaWiki:Gadget-Countdown.js

示例

{{Timer|January 1 2023 00:00:00 +0900|extra_style = text-align:left}}

{{Timer|January 1 2030 00:00:00 +0900|2|style = font-style:italic|text = 还没到。}}

{{Timer|January 19 2038 12:14:07 +0900|3|style = font-weight:bold|text = 就是现在!}}

countup 示例

{{Timer|January 1 2020 00:00:00 +0900|countup=true|extra_style = text-align:left}}

{{Timer|January 1 1980 00:00:00 +0900|countup=true|style = font-style:italic|text = 之前}}

{{Timer|January 19 2038 12:14:07 +0900|countup=true|style = font-weight:bold|text =。对未来时间依然会正数计时。}}