User:ToxiBoi/LiveCountdown: Difference between revisions
mNo edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
| released = {{start date and age|2020|04|15}} |
| released = {{start date and age|2020|04|15}} |
||
| updated = {{start date and age|2020|04|17}} |
| updated = {{start date and age|2020|04|17}} |
||
| version = v1. |
| version = v1.2 |
||
| source = [[User:ToxiBoi/LiveCountdown.js]] |
| source = [[User:ToxiBoi/LiveCountdown.js]] |
||
| browsers = [[Google Chrome]], [[Firefox]]<ref group="lower-roman" name="nottested"/>, [[Microsoft Edge|Edge]] / [[Internet Explorer|IE]]<ref group="lower-roman" name="nottested"/> |
| browsers = [[Google Chrome]], [[Firefox]]<ref group="lower-roman" name="nottested"/>, [[Microsoft Edge|Edge]] / [[Internet Explorer|IE]]<ref group="lower-roman" name="nottested"/> |
||
Line 21: | Line 21: | ||
== To-Do List == |
== To-Do List == |
||
''Feel free to [[WP:BOLD|be bold]] and add anything to this section (with a signature if you want).'' |
''Feel free to [[WP:BOLD|be bold]] and add anything to this section (with a signature if you want).'' |
||
*Allow more than one countdowns to be supported |
*<s>Allow more than one countdowns to be supported</s> |
||
**{{Ack}}. Right as I find out how, I'll be implementing this as soon as possible. A culprit may be the function inside of the scan loop, so this might work if the two are separated. –<span style="font-variant:small-caps">[[User:ToxiBoi|<span style="color:purple">'''Toxi'''</span>]][[User talk:ToxiBoi|<span style="color:orange">Boi!</span>]]</span> <sup>([[Special:Contributions/ToxiBoi|contribs]])</sup> 00:05, 17 April 2020 (UTC) |
**{{Ack}}. Right as I find out how, I'll be implementing this as soon as possible. A culprit may be the function inside of the scan loop, so this might work if the two are separated. –<span style="font-variant:small-caps">[[User:ToxiBoi|<span style="color:purple">'''Toxi'''</span>]][[User talk:ToxiBoi|<span style="color:orange">Boi!</span>]]</span> <sup>([[Special:Contributions/ToxiBoi|contribs]])</sup> 00:05, 17 April 2020 (UTC) |
||
***{{Done}} in version v1.2. The function inside of the loop was part of the issue, making the script single-threaded. Moving the loop outside of the function prevents the loop from focusing on just one countdown. –<span style="font-variant:small-caps">[[User:ToxiBoi|<span style="color:purple">'''Toxi'''</span>]][[User talk:ToxiBoi|<span style="color:orange">Boi!</span>]]</span> <sup>([[Special:Contributions/ToxiBoi|contribs]])</sup> 04:13, 17 April 2020 (UTC) |
|||
*Add error handling for unknown parameters |
*Add error handling for unknown parameters |
||
**Right now, it only says '''NaN''' and the countdown freezes. |
**Right now, it only says '''NaN''' and the countdown freezes. |
Revision as of 04:13, 17 April 2020
Description | Replaces invocations of {{User:ToxiBoi/LiveCountdownTemplate}} with a live countdown that refreshes the page on finish |
---|---|
Author(s) | ToxiBoi (talk · contribs) |
Status | Status: Alpha |
First released | April 15, 2020 |
Version | v1.2 |
Updated | April 17, 2020 |
Browser support | Google Chrome, Firefox[i], Edge / IE[i] |
Skin support | Cologne Blue, Vector, Modern, Monobook, Timeless, MinervaNeue[i] |
Source | User:ToxiBoi/LiveCountdown.js |
A userscript that, upon installing, checks the page for all {{User:ToxiBoi/LiveCountdownTemplate}} (further referenced with LCT) transclusions and replaces them with a working countdown. The LCT is similar to the {{Countdown}} template, however, the template may switch between the two when necessary.[ii]
Right now, this userscript is in a very basic state, so don't expect much.
Installation instructions
Hint: It's much easier if you get ScriptInstaller, then navigate to User:ToxiBoi/LiveCountdown.js and click "Install" at the top.
However, here's the manual method:
- Place
{{subst:iusc|User:ToxiBoi/LiveCountdown.js}}
on Special:MyPage/common.js or a skin-specific page, like Special:MyPage/vector.js. - Clear your cache and enjoy!
To-Do List
Feel free to be bold and add anything to this section (with a signature if you want).
Allow more than one countdowns to be supported- Add error handling for unknown parameters
- Right now, it only says NaN and the countdown freezes.
- Confirmed at User:ToxiBoi/LiveCountdownTemplate. –ToxiBoi! (contribs) 00:05, 17 April 2020 (UTC)
- Right now, it only says NaN and the countdown freezes.
- Add a check to see if the countdown works, without invoking the script directly
- Maybe in a form of special page that the script will change?
Write TemplateData- Allow modification of {{Countdown}} displays
- Not done for now. This may not be possible, as the countdown isn't wrapped in any div or span nor even a class. It's added as a regular paragraph; therefore, a script cannot detect it via regular methods. If it DOES become wrappable in a tag other than "p", then it may even be hard to grab the end date from the display anyway. It's only stored in the module, and the module is pretty much done before the script kicks in. I may consider a non-Lua-based template; however, LCT is the best compatible version of this. –ToxiBoi! (contribs) 23:33, 16 April 2020 (UTC)
TemplateData
This is the documentation for the corresponding template.
TemplateData for ToxiBoi
When used in conjunction with the LiveCountdown userscript, displays a live countdown that refreshes the page on completion
Parameter | Description | Type | Status | |
---|---|---|---|---|
Tag | tag | The HTML tag to wrap the countdown around (for example, "b" or "small")
| Line | optional |
Event Name | event | The name of the event (to fill in the blank "there are 2 seconds until _____")
| String | suggested |
Custom Date | customdate | ADVANCED: add a custom date. Adding this parameter will override the other date parameters, but may likely prevent non-users from seeing your countdown. | String | optional |
Month | month | The month of when the countdown should disable. Can be a name (Dec, July) or a number (10, 2). | String | suggested |
Day | day | The day of when the countdown should disable. Can be a name (Dec, July) or a number (10, 2). | String | suggested |
Year | year | The year of when the countdown should disable (2020, 3000). | String | optional |
Time | time | The 24-hour time (12:00-24:00) when the countdown should disable. This cannot be shown to non-users. | String | optional |
Notes
- ^ a b c The userscript is presumed to work with this enabled, but it is impossible for the maintainers to test it (as of Thu, 16 Apr 2020 23:00:03 +0000). Proceed with caution.
- ^ The LCT checks its parameters to see if it could be referenced with the other {{Countdown}} template, and if so, it will display the Countdown template with an ad: (Tired of purging every few minutes? Try this userscript!)
If the countdown template errors in the process, a firewall would be shown, preventing users from seeing it without downloading the script: You must have the LiveCountdown userscript enabled to view this countdown.