A simple countdown timer that is accurate to the second and takes into account Daylight Savings Time.
For use on the WARFRAME wiki. Credit to fellow wiki contributors for original code.
Open CountdownTest.html or WorldStateTimers.html with your preferred HTML5 compliant browser and enable JavaScript.
Create a Template page that transcludes all the required elements to start a countdown timer. For example:
<span class="customcountdown" style="font-size: 18px;">
<span style="display:none" class="seedDate">January 30, 2021 22:35:00 UTC</span>
<span style="display:none" class="bText"> Timer Ends In</span>
<span style="display:none" class="bDelayText"> Delay Timer Ends In</span>
<span class="timer"></span>
<span style="display:none" class="aText"> (Placeholder Text)</span>
<span style="display:none" class="aDelayText"> (Placeholder Delay Text)</span>
<span style="display:none" class="loopTime">10s</span>
<!-- Negative values mean infinite number of timer loops -->
<span style="display:none" class="loopLimit">-1</span>
<span style="display:none" class="endText">Countdown Complete</span>
<span style="display:none" class="delayTime"></span>
<!-- Blank entry signals program to show delay timer -->
<span style="display:none" class="delayDisplay"></span>
<!-- Blank entry signals program to account for Daylight Savings Time -->
<span style="display:none" class="dst"></span>
<!-- Y - Years, M - Months, D - Days, h - Hours, m - Minutes, s - Seconds -->
<span style="display:none" class="dateFormat">YY MM DD hh mm ss</span>
<!-- Options are "", "single", or "full" -->
<span style="display:none" class="dateLabels">single</span>
</span>
Next, copy and paste the JavaScript code onto a page ending with ".js" within the MediaWiki namespace in order to have the countdown code run on all pages within the wiki.
If you want to use this countdown timer on FANDOM wikis, you will also need to add the name of MediaWiki page containing the script to the MediaWiki:ImportJS page. See this for more information.
Please feel free to fork this repository and develop on it. Issues and suggestions can be posted under the issues tab. Code written in Countdown.js must be written in ECMAScript 3rd Edition compliant syntax in order to run on FANDOM wikis.
- FANDOM uses MediaWiki 1.33.3 as of 1/29/2021.
- Its ResourceLoader supports ES3 syntax and modern features of JavaScript such as Sets, Maps, Promises, RegExp, and etc.
- There is no support for classes, arrow functions, inline getters, let keyword, for...of statement, spread operator, and etc.
- https://warframe.fandom.com/wiki/MediaWiki:Countdown.js
- https://warframe.fandom.com/wiki/MediaWiki:CountDown.js (outdated and unused by wiki)