Fandom Developers Wiki
No edit summary
Line 1: Line 1:
  +
__TOC__
<div style="text-align:center; font-size: 200%; line-height: 100%;">If you need help using this code, please leave a message on [[User_talk:Eladkse|Eladkse's talk page]].</div>
 
  +
==Misc==
 
 
 
It doesn't seem to work.--<big>[[User:Pikapi|''<font color="teal">Chris</font>'']]</big> [[User_talk:Pikapi|<font color="blue">''talk''</font>]] [[User_blog:Pikapi|<font color="blue">''blog''</font>]] 16:08, August 9, 2010 (UTC)
 
It doesn't seem to work.--<big>[[User:Pikapi|''<font color="teal">Chris</font>'']]</big> [[User_talk:Pikapi|<font color="blue">''talk''</font>]] [[User_blog:Pikapi|<font color="blue">''blog''</font>]] 16:08, August 9, 2010 (UTC)
   

Revision as of 19:57, 26 March 2013

Misc

It doesn't seem to work.--Chris talk blog 16:08, August 9, 2010 (UTC)

Is there a way to remove the "T minus" part of the countdown? NeocarleenTalk

Update to Code

I'd like to propose an update to the code. My modified code here determines whether it should be sigular or plural (1 second instead of 1 seconds).    ǝsʞpɐןǝ  (talk page)  20:01, 6/07/2011

I've added the code. Feel free to remove it if I shouldn't have.    ǝsʞpɐןǝ  (talk page)  15:24, 7/07/2011

Error

Okay, the message when the countdown isn't working is displaying. But what do I do now? Bereisgreat Shout! [[Special:Editcount/Bereisgreat| Special:Editcount/Bereisgreat edits on this Wiki ]]  19:24, March 29, 2012 (UTC)

No more counting up!

I'd like to offer some improvement for the code. You can see my version here. It adds another <span class> where you can make a custom message to display once the countdown is finished. The timer now will not count up once the countdown has finished and this message will be displayed instead. Land Raider 20:34, July 1, 2012 (UTC)

I considered changing the code a while back to work this way. The version of the code I run at Casualty Wiki has been customised so it knows when an episode is on air or has finished airing. However, after some reflection and looking at how other wikis use the code, I decided not to - as some wikis actually do use countups instead of countdowns. Your idea has merit, so I will look into integrating it into version 2.    ǝsʞpɐןǝ  (talk page)  09:34, 02/07/2012

Countdown code need to be checked

The current countdown script works really slow and need to be improved. Currently the script use is also really messy so maybe we beter make an total new version for it

What code should be used (my opinion, if possible)

<countdown>January 01 2013 00:00:00</countdown>

And with all options:

<countdown configuration="preload:Javascript disabled.; additions:Only <t> until the new year...; display:ymdhms;" style="...">January 01 2013 00:00:00</countdown>

--Jens Ingels (talk) 00:59, August 16, 2012 (UTC)

By 'script', are you referring to the html used to insert the countdown, or the JavaScript itself?
I agree that the current html is messy, but any change to how the html is used would mean a separate version of the JavaScript would be needed, as a lot of wikis use the current format. This would be possible, but I just want to clarify what you think should be done. I personally think the script is rather quick.    ǝsʞpɐןǝ  (talk page)  14:32, 16/08/2012
(edit) I see a flaw in your 'better' html. The reason the 'JavaScript disabled' text is separate... is because it needs to display when JavaScript isn't working properly. You can't use JavaScript to say there isn't any JavaScript! ;)    ǝsʞpɐןǝ  (talk page)  14:36, 16/08/2012

With the script speed I'm talking about the switch between non JavaScript and when the script is activated. Currently it takes an long time (like 1-2 seconds) te replace the alternative text to the countdown what's in my opinion really slow. The code is just an example how it could display beter, I never said it could be an working code. Couldn't there be an save cookie option or something that can speedup the loading time ones you visited the page the first time.--Jens Ingels (talk) 15:57, August 17, 2012 (UTC)

The script loads virtually instantly on the wikis I use it on. Either your 1-2 seconds is an over estimate, or the wiki you have it applied to has a lot of js to load. Would you mind linking me to the wiki you run the script on, and a page with a countdown so I can test?
The main bulk of the countdown code was developed by an old user, but from what I understand of it, it seems very efficient as it is. If you want to suggest some actual script changes then of course, feel free, as I don't know the extent of your js knowledge.    ǝsʞpɐןǝ  (talk page)  14:06, 19/08/2012

2 Questions

  1. Is the "JavaScript disabled" thingy really necessary?
  2. Why does the countdown count up after it's finished?

I added a Dutch translation btw. --  pecoes  07:08, December 08, 2012 (UTC) 

  1. When the code was first written, I suspect it was more necessary than it is today. However, this is still useful to to wikis, as alternate text if for some reason the code isn't working. For example, this template counts down to the next episode of a show. if you look closely, you will see that the alternate text provides the same information, but without the live countdown: "will air on 15 December 2012 at 21:00". However, you can just not use the 'nocountdown' bit, and it will work fine.
  2. This is by design. I have seen some wikis use the code to count up - not many, but enough to justify keeping the functionality in this way. The main reason I haven't changed a lot of things in this code is because of it's wide usage on other wikis. At Casualty Wiki, I ran a customised version of the code. When the countdown reaches zero, it displays a line of text instead. While this can easily be done here, it would need to be customisable on a per-countdown basis - requiring another span tag in the syntax. While this isn't a big problem, compatibility is something I have always put first when considering changes to the code.
I am not a very good coder. I will be the first to admit that - and it is often obvious when others look at my codes. I 'adopted' the Countdown script as I needed it to be more versatile at the time. If you think you can improve the script without breaking the compatibility, feel free to suggest changes. I've done a lot of patchwork editing on this, and I'm sure it can be streamlined.
Thanks for the translation.    ǝsʞpɐןǝ  (talk page)  10:40, 8 December 2012
The "JavaScript disabled" thing is already optional. It cannot be removed from the code of course, but if it was up to me, I'd remove it from the documentation at least. There was a time when Wikia was usable without JavaScript but that's a distant memory :)
If some wikis count on counting up, then it must stay, but I think other options should be provided:
  1. remove the countdown
  2. let it stay at zero
  3. show alternate content
All of these can be done without breaking compatibility.
If you don't mind I'll write something... --  pecoes  10:54, December 08, 2012 (UTC) 
I've altered the documentation. Feel free to write something, but could you run it by me first in this talk page? It just helps me keep on top of everything. Cheers.    ǝsʞpɐןǝ  (talk page)  11:00, 8 December 2012
No problem. You've taken this addon in your care. I respect that.
This is a bit unorthodox, but since it's apparently possible to have more than one countdown per page I'd suggest adding the data directly to the wikitext instead of the JS code. That might be simpler...
So I propose to add three (optional) new attributes to the countdown span:
  • data-end — specifies how the end should be handled:
    • value: "continue" (default) — continue counting
    • value: "stop" — stop at zero
    • value: "remove" — remove the countdown
    • value: "toggle" — set another tag's display to "inline" and the countdown's to "none"
    • value: "callback" — call a JavaScript function
  • data-toggle — another inline tag to show instead (to be used with data-end="toggle")
  • data-callback — a JavaScript function to call (to be used with data-end="callback")
Example:
<span data-end="toggle" data-toggle="countdown-end" class="countdown" style="display:none;">
Only <span class="countdowndate">January 01 2013 00:00:00</span> until the new year...
</span>
<span class="countdown-end" style="display: none;">Happy 2013!</span>


I hope this is sufficiently flexible without making things complicated.
(I've already tested it btw: The wikitext parser does not discard attributes with a "data-" prefix.)
--  pecoes  12:57, December 08, 2012 (UTC) 
This seems practical - I assume it defaults to countup if no data-end is defined?
I would like to see the script in action before we commit it to the dev version. There's no rush toany of this, but when/if you get a chance to code it, put on a sandbox or something so I can take a look.    ǝsʞpɐןǝ  (talk page)  14:20, 8 December 2012
Alright. Here's the my rewrite proposal: [[w:c:pecoes:Countdown.js]] and you can test it here: [[w:c:pecoes:Countdown]]. If you want to test the callback, try "demo". The demo function will show an alert when the countdown ends. --  pecoes  20:32, December 08, 2012 (UTC)  (Files have been removed)
Yeah, I'm perfectly happy with that. It's nice to see the script rewritten actually. I certainly would not have been able to overhaul the script like this, so thank you.
If you think it is ready, feel free to update the code page and documentation. Something that might be useful to add to the code though is checks to see if we need days/hours/minutes and remove the largest interval once it reaches zero. A simple delta > 0 should do. What are your thoughts?    ǝsʞpɐןǝ  (talk page)  11:38, 9 December 2012

────────────────────────────────────────────────────────────────────────────────────────────────────Yeah. That's easy to do. Personally I like the leading zeros. They give the countdown more gravitas :)

I will have to add another option then. This may not be the last option request, so I'd rather use something generic like data-option="hide-leading-zeros"  pecoes  13:18, December 09, 2012 (UTC) 

I just read Jens Ingels post... he seems to want more formatting options for the output. Has that been requested a lot? Cause that would be a boatload of work :( --  pecoes  13:54, December 09, 2012 (UTC) 
I haven't really seen any requests similar to what Jens is describing. I think the code is fine as it is...    ǝsʞpɐןǝ  (talk page)  21:33, 9 December 2012

Suggestion: Short counter

I use a customised version of Splarka's original countdown script, with a short form of the countdown "d days, h:m:s" to save space. It would be convenient if this script had a short option. -452 18:54, March 26, 2013 (UTC)

I could alter the script so that it would accept a custom format function. Something like this:
window.countdownTimer = {
    format: function (seconds) {
        return seconds + ' left';
    }
};

 pecoes  19:16, March 26, 2013 (UTC)