跳转到内容

模板:生物联赛倒计时:修订间差异

来自osm&bio
Magezeya留言 | 贡献
无编辑摘要
Magezeya留言 | 贡献
无编辑摘要
 
第1行: 第1行:
🧬
<includeonly>
全国中学生生物学联赛倒计时
<div class="biology-countdown">
距离{{{text|全国奥林匹克生物学联赛}}}还有
  <div class="countdown-header">
{{#ifexpr: {{#time:U}} < {{#time:U|2025-05-11}} | {{#switch: {{{time|day}}} | day =
    <div class="dna-icon">🧬</div>
{{#expr: floor(({{#time:U|2025-05-11}} - {{#time:U}})/86400)}}
    <h3>全国中学生生物学联赛倒计时</h3>
  </div>
| hour =
 
{{#expr: floor(({{#time:U|2025-05-11}} - {{#time:U}})/3600)}}
  <div class="countdown-content">
小时
    <div class="countdown-text">
| minute =
      距离{{#if: {{{text|}}} | {{{text}}} | 全国奥林匹克生物学联赛}}还有
{{#expr: floor(({{#time:U|2025-05-11}} - {{#time:U}})/60)}}
    </div>
分钟
   
| second =
    <div class="countdown-timer">
{{#expr: {{#time:U|2025-05-11}} - {{#time:U}}}}
      <!-- 确定下一个联赛日期并计算倒计时 -->
      {{#ifexpr: {{#time:U}} < {{#time:U|2025-05-11}} |
}} | {{#ifexpr: {{#time:U}} < {{#time:U|2026-05-10}} | {{#switch: {{{time|day}}} | day =
        <!-- 使用2025年日期 -->
{{#expr: floor(({{#time:U|2026-05-10}} - {{#time:U}})/86400)}}
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2025-05-11}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
| hour =
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2025-05-11}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
{{#expr: floor(({{#time:U|2026-05-10}} - {{#time:U}})/3600)}}
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2025-05-11}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
小时
          | second = <span class="countdown-number">{{#expr: {{#time:U|2025-05-11}} - {{#time:U}}}}</span><span class="countdown-unit"></span>
| minute =
        }}
{{#expr: floor(({{#time:U|2026-05-10}} - {{#time:U}})/60)}}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2026-05-10}} |
分钟
        <!-- 使用2026年日期 -->
| second =
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
{{#expr: {{#time:U|2026-05-10}} - {{#time:U}}}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2026-05-10}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2026-05-10}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
}} | {{#ifexpr: {{#time:U}} < {{#time:U|2027-05-09}} | {{#switch: {{{time|day}}} | day =
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2026-05-10}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
{{#expr: floor(({{#time:U|2027-05-09}} - {{#time:U}})/86400)}}
          | second = <span class="countdown-number">{{#expr: {{#time:U|2026-05-10}} - {{#time:U}}}}</span><span class="countdown-unit"></span>
        }}
| hour =
      | {{#ifexpr: {{#time:U}} < {{#time:U|2027-05-09}} |
{{#expr: floor(({{#time:U|2027-05-09}} - {{#time:U}})/3600)}}
        <!-- 使用2027年日期 -->
小时
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
| minute =
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2027-05-09}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
{{#expr: floor(({{#time:U|2027-05-09}} - {{#time:U}})/60)}}
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2027-05-09}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
分钟
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2027-05-09}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
| second =
          | second = <span class="countdown-number">{{#expr: {{#time:U|2027-05-09}} - {{#time:U}}}}</span><span class="countdown-unit"></span>
{{#expr: {{#time:U|2027-05-09}} - {{#time:U}}}}
        }}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2028-05-14}} |
}} | {{#ifexpr: {{#time:U}} < {{#time:U|2028-05-14}} | {{#switch: {{{time|day}}} | day =
        <!-- 使用2028年日期 -->
{{#expr: floor(({{#time:U|2028-05-14}} - {{#time:U}})/86400)}}
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2028-05-14}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
| hour =
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2028-05-14}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
{{#expr: floor(({{#time:U|2028-05-14}} - {{#time:U}})/3600)}}
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2028-05-14}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
小时
          | second = <span class="countdown-number">{{#expr: {{#time:U|2028-05-14}} - {{#time:U}}}}</span><span class="countdown-unit"></span>
| minute =
        }}
{{#expr: floor(({{#time:U|2028-05-14}} - {{#time:U}})/60)}}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2029-05-13}} |
分钟
        <!-- 使用2029年日期 -->
| second =
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
{{#expr: {{#time:U|2028-05-14}} - {{#time:U}}}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2029-05-13}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2029-05-13}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
}} | {{#ifexpr: {{#time:U}} < {{#time:U|2029-05-13}} | {{#switch: {{{time|day}}} | day =
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2029-05-13}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
{{#expr: floor(({{#time:U|2029-05-13}} - {{#time:U}})/86400)}}
          | second = <span class="countdown-number">{{#expr: {{#time:U|2029-05-13}} - {{#time:U}}}}</span><span class="countdown-unit"></span>
        }}
| hour =
      | {{#ifexpr: {{#time:U}} < {{#time:U|2030-05-12}} |
{{#expr: floor(({{#time:U|2029-05-13}} - {{#time:U}})/3600)}}
        <!-- 使用2030年日期 -->
小时
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
| minute =
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2030-05-12}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
{{#expr: floor(({{#time:U|2029-05-13}} - {{#time:U}})/60)}}
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2030-05-12}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
分钟
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2030-05-12}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
| second =
          | second = <span class="countdown-number">{{#expr: {{#time:U|2030-05-12}} - {{#time:U}}}}</span><span class="countdown-unit"></span>
{{#expr: {{#time:U|2029-05-13}} - {{#time:U}}}}
        }}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2031-05-11}} |
}} | {{#ifexpr: {{#time:U}} < {{#time:U|2030-05-12}} | {{#switch: {{{time|day}}} | day =
        <!-- 使用2031年日期 -->
{{#expr: floor(({{#time:U|2030-05-12}} - {{#time:U}})/86400)}}
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2031-05-11}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
| hour =
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2031-05-11}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
{{#expr: floor(({{#time:U|2030-05-12}} - {{#time:U}})/3600)}}
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2031-05-11}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
小时
          | second = <span class="countdown-number">{{#expr: {{#time:U|2031-05-11}} - {{#time:U}}}}</span><span class="countdown-unit">极</span>
| minute =
        }}
{{#expr: floor(({{#time:U|2030-05-12}} - {{#time:U}})/60)}}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2032-05-09}} |
分钟
        <!-- 使用2032年日期 -->
| second =
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
{{#expr: {{#time:U|2030-05-12}} - {{#time:U}}}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2032-05-09}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2032-05-09}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
}} | {{#ifexpr: {{#time:U}} < {{#time:U|2031-05-11}} | {{#switch: {{{time|day}}} | day =
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2032-05-09}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
{{#expr: floor(({{#time:U|2031-05-11}} - {{#time:U}})/86400)}}
          | second = <span class="countdown-number">{{#expr: {{#time:U|2032-05-09}} - {{#time:U}}}}</span><span class="countdown-unit"></span>
        }}
| hour =
      | {{#ifexpr: {{#time:U}} < {{#time:U|2033-05-08}} |
{{#expr: floor(({{#time:U|2031-05-11}} - {{#time:U}})/3600)}}
        <!-- 使用2033年日期 -->
小时
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
| minute =
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2033-05-08}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
{{#expr: floor(({{#time:U|2031-05-11}} - {{#time:U}})/60)}}
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2033-05-08}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
分钟
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2033-05-08}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
| second =
          | second = <span class="countdown-number">{{#expr: {{#time:U|2033-05-08}} - {{#time:U}}}}</span><span极 class="countdown-unit"></span>
{{#expr: {{#time:U|2031-05-11}} - {{#time:U}}}}
        }}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2034-05-14}} |
}} | {{#ifexpr: {{#time:U}} < {{#time:U|2032-05-09}} | {{#switch: {{{time|day}}} | day =
        <!-- 使用2034年日期 -->
{{#expr: floor(({{#time:U|2032-05-09}} - {{#time:U}})/86400)}}
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2034-05-14}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
| hour =
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2034-05-14}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
{{#expr: floor(({{#time:U|2032-05-09}} - {{#time:U}})/3600)}}
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2034-05-14}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
小时
          | second = <span class="countdown-number">{{#expr: {{#time:U|2034-05-14}} - {{#time:U}}}}</span><span class="countdown-unit"></span>
| minute =
        }}
{{#expr: floor(({{#time:U|2032-05-09}} - {{#time:U}})/60)}}
      | {{#ifexpr: {{#time:U}} < {{#time:U|2035-05-13}} |
分钟
        <!-- 使用2035年日期 -->
| second =
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
{{#expr: {{#time:U|2032-05-09}} - {{#time:U}}}}
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
}} | {{#ifexpr: {{#time:U}} < {{#time:U|2033-05-08}} | {{#switch: {{{time|day}}} | day =
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
{{#expr: floor(({{#time:U|2033-05-08}} - {{#time:U}})/86400)}}
          | second = <span class="countdown-number">{{#expr: {{#time:极U|2035-05-13}} - {{#time:U}}}}</span><span class="countdown-unit"></span>
        }}
| hour =
      |  
{{#expr: floor(({{#time:U|2033-05-08}} - {{#time:U}})/3600)}}
        <!-- 如果所有日期都已过去,显示2035年日期 -->
小时
        {{#switch: {{#if: {{{time|}}} | {{{time}}} | day}}
| minute =
          | day = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/86400)}}</span><span class="countdown-unit"></span>
{{#expr: floor(({{#time:U|2033-05-08}} - {{#time:U}})/60)}}
          | hour = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/3600)}}</span><span class="countdown-unit">小时</span>
分钟
          | minute = <span class="countdown-number">{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/60)}}</span><span class="countdown-unit">分钟</span>
| second =
          | second = <span class="countdown-number">{{#expr: {{#time:U|2035-05-13}} - {{#time:U}}}}</span><span class="countdown-unit"></span>
{{#expr: {{#time:U|2033-05-08}} - {{#time:U}}}}
        }}
      }}}}}}}}}}}}
}} | {{#ifexpr: {{#time:U}} < {{#time:U|2034-05-14}} | {{#switch: {{{time|day}}} | day =
    </div>
{{#expr: floor(({{#time:U|2034-05-14}} - {{#time:U}})/86400)}}
   
    <div class="countdown-date">
| hour =
      下一届联赛日期:  
{{#expr: floor(({{#time:U|2034-05-14}} - {{#time:U}})/3600)}}
      {{#ifexpr: {{#time:U}} < {{#time:U|2025-05-11}} | 2025-05-11 |
小时
        {{#ifexpr: {{#time:U}} < {{#time:U|2026-05-10}} | 2026-05-10 |
| minute =
          {{#ifexpr: {{#time:U}} < {{#time:U|2027-05-09}} | 2027-05-09 |
{{#expr: floor(({{#time:U|2034-05-14}} - {{#time:U}})/60)}}
            {{#ifexpr: {{#time:U}} < {{#time:U|2028-05-14}} | 2028-05-14 |
分钟
              {{#ifexpr: {{#time:U}} < {{#time:U|2029-05-13}} | 2029-05-13 |
| second =
                {{#ifexpr: {{#time:U}} < {{#time:U|2030-05-12}} | 2030-05-12 |
{{#expr: {{#time:U|2034-05-14}} - {{#time:U}}}}
                  {{#ifexpr: {{#time:U}} < {{#time:U|2031-05-11}} | 2031-05-11 |
                    {{#ifexpr: {{#time:U}} < {{#time:U|2032-05-09}} | 2032-05-09 |
}} | {{#ifexpr: {{#time:U}} < {{#time:U|2035-05-13}} | {{#switch: {{{time|day}}} | day =
                      {{#ifexpr: {{#time:U}} < {{#time:U|2033-05-08}} | 2033-05-08 |
{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/86400)}}
                        {{#ifexpr: {{#time:U}} < {{#time:U|2034-05-14}} | 2034-05-14 |
                          {{#ifexpr: {{#time:U}} < {{#time:U|2035-05-13}} | 2035-05-13 | 2035-05-13
| hour =
                          }}
{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/3600)}}
                        }}
小时
                      }}
| minute =
                    }}
{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/60)}}
                  }}
分钟
                }}
| second =
              }}
{{#expr: {{#time:U|2035-05-13}} - {{#time:U}}}}
            }}
          }}
}} | {{#switch: {{{time|day}}} | day =
        }}
{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/86400)}}
      }}
    </div>
| hour =
  </div>
{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/3600)}}
 
小时
  <div class="countdown-footer">
| minute =
    <small>全国中学生生物学竞赛委员会</small>
{{#expr: floor(({{#time:U|2035-05-13}} - {{#time:U}})/60)}}
  </div>
分钟
</div>
| second =
 
{{#expr: {{#time:U|2035-05-13}} - {{#time:U}}}}
<style>
.biology-countdown {
}} }}}}}}}}}}}}
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
下一届联赛日期: {{#ifexpr: {{#time:U}} < {{#time:U|2025-05-11}} | 2025-05-11 | {{#ifexpr: {{#time:U}} < {{#time:U|2026-05-10}} | 2026-05-10 | {{#ifexpr: {{#time:U}} < {{#time:U|2027-05-09}} | 2027-05-09 | {{#ifexpr: {{#time:U}} < {{#time:U|2028-05-14}} | 2028-05-14 | {{#ifexpr: {{#time:U}} < {{#time:U|2029-05-13}} | 2029-05-13 | {{#ifexpr: {{#time:U}} < {{#time:U|2030-05-12}} | 2030-05-12 | {{#ifexpr: {{#time:U}} < {{#time:U|2031-05-11}} | 2031-05-11 | {{#ifexpr: {{#time:U}} < {{#time:U|2032-05-09}} | 2032-05-09 | {{#ifexpr: {{#time:U}} < {{#time:U|2033-05-08}} | 2033-05-08 | {{#ifexpr: {{#time:U}} < {{#time:U|2034-05-14}} | 2034-05-14 | {{#ifexpr: {{#time:U}} < {{#time:U|2035-05-13}} | 2035-05-13 | 2035-05-13 }} }} }} }} }} }} }} }} }} }} }}
  border-radius: 12px;
全国中学生生物学竞赛委员会
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid #81c784;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  max-width: 400px;
  margin: 10px auto;
  text-align: center;
  position: relative;
  overflow: hidden;
}
 
.biology-countdown::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90极deg, #4caf50, #8bc34a, #cddc39);
}
 
.countdown-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}
 
.dna-icon {
  font-size: 28px;
  margin-right: 10px;
}
 
.countdown-header h3 {
  margin: 0;
  color: #2e7d32;
  font-size: 18px;
  font-weight: 600;
}
 
.countdown-content {
  margin: 15px 0;
}
 
.countdown-text {
  color: #388e3c;
  font-size: 16px;
  margin-bottom: 10px;
}
 
.countdown-timer {
  display: flex;
  justify-content: center;
  align-items: baseline;
  margin: 15px 0;
}
 
.countdown-number {
  font-size: 36px;
  font-weight: bold;
  color: #d32f2f;
  margin: 0 5px;
  animation: pulse 2s infinite;
}
 
.countdown-unit {
  font-size: 18px;
  color: #555;
  margin-left: 5px;
}
 
.countdown-date {
  color: #689f38;
  font-size: 14px;
  margin-top: 10px;
  font-style: italic;
}
 
.countdown-footer {
  border-top: 1px solid #a5d6a7;
  padding-top: 10px;
  margin-top: 15px;
}
 
.countdown-footer small {
  color: #78909c;
  font-size: 12px;
}
 
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
 
@media (max-width: 480px) {
  .biology-countdown {
    padding: 15px;
    margin: 10px;
  }
 
  .countdown-number {
    font-size: 28px;
  }
 
  .countdown-header h3 {
    font-size: 16px;
  }
}
</style>
</includeonly>
 
<noinclude>
{{documentation}}
</noinclude>

2025年8月22日 (五) 12:22的最新版本


模板文档  [[{{fullurl:local p = {}

-- 预定义的联赛日期表(2025-2035年五月的第二个星期日) local olympiadDates = {

   "2025-05-11",
   "2026-05-10",
   "2027-05-09",
   "2028-05-14",
   "2029-05-13",
   "2030-05-12",
   "2031-05-11",
   "2032-05-09",
   "2033-05-08",
   "2034-05-14",
   "2035-05-13"

}

function p.getNextDate()

   local currentTime = os.time()
   
   for i, dateStr in ipairs(olympiadDates) do
       local datePattern = "(%d+)-(%d+)-(%d+)"
       local year, month, day = dateStr:match(datePattern)
       local olympiadTime = os.time({year = year, month = month, day = day})
       
       if olympiadTime > currentTime then
           return dateStr
       end
   end
   
   -- 如果所有日期都已过去,返回最后一个日期
   return olympiadDates[#olympiadDates]

end

return p|action=edit}} 创建]] [刷新]