打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

Template:Countdown:修订间差异

模板页面
imported>弃权者
无编辑摘要
弃权者留言 | 贡献
无编辑摘要
 
(未显示2个用户的2个中间版本)
第1行: 第1行:
<includeonly>{{#ifeq:{{#expr: {{#expr: {{#time:U}} + 28800}} < {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}}}}|1|{{{a|距離}}}{{{event|這次事件}}}{{{b|尚餘}}}{{#ifeq:{{#expr: {{#expr: {{#time:U}} + 28800}} < {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - 86399}}|1|'''<span style="color: {{{color|red}}}">{{#expr:( ( ( {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}}) / 86400 ) -0.5) round 0}}</span>'''天|}}{{#ifeq:{{#expr: {{#expr: {{#time:U}} + 28800}} > {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - 3600}}|1|{{#ifeq: {{#expr: ( ( ( {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}} ) / 60 ) - 0.5 ) round 0 }}|0|'''<span style="color: {{{color|red}}}">{{#expr: {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}}}}</span>'''秒|'''<span style="color: {{{color|red}}}">{{#expr: ( ( ( {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}} ) / 60 ) - 0.5 ) round 0 }}</span>'''分鐘}}|'''<span style="color: {{{color|red}}}">{{#expr:{{#expr: ( {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}} ) / 3600 - ( ( ( ( ( ( {{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} - {{#expr: {{#time:U}} + 28800}}) / 86400 ) - 0.5 ) round 0 )* 24 ) -0.5 ) round 0}} - 1}}</span>'''小時}}|{{#if:{{{duration|}}}|{{#ifeq:{{#expr: ({{#if:{{{timecode|}}}|{{{timecode|}}}|{{#time:U|{{{year}}}-{{{month|1}}}-{{{day|1}}} {{{hour|00}}}:{{{minute|00}}}:{{{second|00}}}}}}} + {{{duration}}}) > {{#expr: {{#time:U}} + 28800}}}}|1|{{{eventstart|{{{event|這次事件}}}已經開始}}}|{{{eventend|{{{event|這次事件}}}已完結}}}}}|{{{eventend|{{{event|這次事件}}}已完結}}}}}}}{{#if:{{yesno|{{{nopurge|}}}}}||<small>({{purge|更新}})</small>}}</includeonly><noinclude>{{Documentation}}</noinclude>
<includeonly>{{#widget:Countdown
|t={{{1|}}}
|time={{{time|}}}
|before={{{before|}}}
|after={{{after|}}}
}}</includeonly><noinclude>{{Documentation}}</noinclude>

2026年5月3日 (日) 15:29的最新版本

  模板文档 TEMPLATE DOCUMENTATION   [查看] [编辑] [历史] [刷新]

本模板用以实时显示特定时间与现在的差距。相比于传统模板,本模板基于 JavaScript 实现,无需刷新页面即可看到秒级跳动,且不会因服务器缓存导致计时错误。

参数

time / 匿名参数 1
指定目标时间。
支持 ISO 格式(如 2013-10-04)/带时区的格式(+09:00)/仅年份。
特别地,若想用于每日倒计时,可使用参数today-end
before
当目标时间早于现在时(过去)显示的文本格式。使用 $1 作为时间差的占位符。默认为 $1前
after
当目标时间晚于现在时(未来)显示的文本格式。使用 $1 作为时间差的占位符。默认为 还剩$1

示例

代码 效果
{{Countdown|time=2013-10-04 20:42+09:00|before=在$1之前|after=将在$1后}} ...
{{Countdown|2027-06-25T18+09}} ...
{{Countdown|time={{LOCALYEAR}}|before=新年已过去$1}} ...
{{Countdown|time={{#expr:{{LOCALYEAR}}+1}}|after=今年还有$1}} ...

注意事项

  • 本模板使用客户端时间。如果用户的系统时间不准确,倒计时显示也会随之偏差。
  • 页面在后台运行(如切换标签页)时会暂停计算以节省 CPU,切回页面时会自动校准。