FANDOM


This is the talk page for discussing improvements to the Countdown page.

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! 6 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) 

Chinese localization

There should be more localization options for Chinese language.

For example, 263 days, 19 hours, 10 minutes and 14 seconds = 263天19小時10分14秒

We don't have spaces and commas between "words". Please add an option to skip those. Sammylau (talk) 20:51, April 11, 2013 (UTC)

This can probably be resolved my modifications discussed above about different countdown formats. Not sure if Pecoes got any further with it though.    ǝsʞpɐןǝ  (talk page)  21:27, 11 April 2013
Take a look at this library and tell me if it's possible to format a chinese date with it, please! --  pecoes  21:36, April 11, 2013 (UTC) 
I'd suggest a more "universal" way to solve this problem. Many Asian languages doesn't need these spaces and commas too.
  • Add an option in the translation part:
        zh: {
            and: '', //Nothing is needed for 'and' in Chinese
            second: '秒',
            seconds: '秒',
            minute: '分',
            minutes: '分',
            hour: '小时',
            hours: '小时',
            day: '天',
            days: '天',
            skipSpaceComma: 'true'
        },


  • Then add more conditions into the output function:
    function output (i, diff) {
        /*jshint bitwise:false*/
        var delta, result, parts = [];
        var space = ' ';
        if (i18n.skipSpaceComma=='true') space='';
        delta = diff % 60;
        parts.unshift(delta + space + i18n[delta === 1 ? 'second' : 'seconds']);
        diff = Math.floor(diff / 60);
        delta = diff % 60;
        parts.unshift(delta + space + i18n[delta === 1 ? 'minute' : 'minutes']);
        diff = Math.floor(diff / 60);
        delta = diff % 24;
        parts.unshift(delta + space + i18n[delta === 1 ? 'hour'   : 'hours'  ]);
        diff = Math.floor(diff / 24);
        parts.unshift(diff  + space + i18n[diff  === 1 ? 'day'    : 'days'   ]);
        result = parts.pop();
        if (countdowns[i].opts & NO_LEADING_ZEROS) {
            while (parts.length && parts[0][0] === '0') {
                parts.shift();
            }
        }
        if (parts.length) {
            if (i18n.skipSpaceComma=='true')
              result = parts.join('') + i18n.and + result;
            else
              result = parts.join(', ') + ' ' + i18n.and + ' ' + result;
        }
        countdowns[i].node.text(result);
    }


Sammylau (talk) 23:33, April 11, 2013 (UTC)
I can see how that would work, yes. That's certainly a good suggestion, but it's less universal than the library I suggested above. With that library everybody could format the time how he/she sees fit for their wiki. Check out the request by 452 above as an example. He apparently wants even more flexibility than your suggestion can provide. Now, if I knew he'd be the last one to make such a request, I'd say "I'm terribly sorry, but I cannot accommodate absolutely everybody" and leave it at that. But chances are, he's just the first one to make such a request...
Since you obviously have some programming skill, I'd be grateful, if you could take a quick look at that library and tell me, if it's possible to properly format a chinese date with it! --  pecoes  04:25, April 12, 2013 (UTC) 

Simply, yes. The library should fix everything. A little hold back for me is that is you need to explain that in depth to let people know how to format it properly. Sammylau (talk) 07:05, April 12, 2013 (UTC)

Yes, I agree. The explanations over there are far too short. It needs more detail. Thanks for testing it though! I'll convert the code. --  pecoes  07:24, April 12, 2013 (UTC) 

Customization

Is it possible to customize the countdown so that you can use the span tags under specific parts? Sort of like <DAYS> being big and in bold, and the rest are smaller, in italics. Maybe even the option to use D:H:M:S, too. I want to do it but I really don't know how I would be able to pull it off. Is it possible, then? Masatoshino (talk) 16:51, April 29, 2013 (UTC)

Putting it in a template

Hi there... I'm trying to put your code into a template so that I can use it on a page like this: {{Countdown}}. For some reason, I can't get it to work properly =( If/When you have time, would you mind having a look for me please. Much appreciated http://img255.imageshack.us/img255/6670/squirrel3kk9.gif Wolbee 12:15, July 2, 2013 (UTC)

Can someone help me?

Can someone tell me what code I would use to add months and years to my count down timers?

HurricaneTeen6900 (talk) 21:50, August 11, 2013 (UTC)HurricaneTeen6900HurricaneTeen6900 (talk) 21:50, August 11, 2013 (UTC)

ISSUE: Using the countdown timer as a count up timer

Greeting everyone,
I have an issue with the countdown timer in a page of my wiki. I've been using the coundown timer template as a "count up timer", because of the lack of a code for it (and my poor knowledge of programming).
[Watch here a view from Google Chrome]
The problem is that, in some dates, it appears "FECHA ERRÓNEA" (WRONG DATE). Here is the JS of the countdown. --See ya':
Ajente02_Firma.JPG 22:42, September 12, 2013 (UTC)

div Tag Limits Functionality

For a while I was frustrated with the options, such as no-leading-zeros and the various data-end settings not working, and it turned out that the <div> tag I was using to change the font size is what caused the problem. I just wanted to point out that putting the countdown inside <div> tags creates such problems, in case anyone else has the issue. --Kelerik (talk) 17:06, January 27, 2014 (UTC)

Support Countdown on wikia mobile display

hi,

would it be possible to make the countdown behave properly on mobile browsers (i.e. in chrome on andriod, the countdown isn't displayed properly). Rlsf (talk) 06:53, March 3, 2014 (UTC)

JavaScript is not loaded in the mobile skin (unless you use some hack for it).~UltimateSupreme 08:44, March 3, 2014 (UTC)

Malay countdown display

Can you put countdown display for Malay? (code:ms)

    ms: {
        and: 'dan',
        second: 'saat',
        seconds: 'saat',
        minute: 'minit',
        minutes: 'minit',
        hour: 'jam',
        hours: 'jam',
        day: 'hari',
        days: 'hari'
    }

SNN95|Talk to me beybeh! 02:25, March 5, 2014 (UTC)

Done :) cqm 13:01, 5 Mar 2014 (UTC)\
Thanks! SNN95|Talk to me beybeh! 18:50, March 7, 2014 (UTC)

Vietnam countdown display

vi: {
       and: 'và',
       second: 'giây',
       seconds: 'giây',
       minute: 'phút',
       minutes: 'phút',
       hour: 'giờ',
       hours: 'giờ',
       day: 'ngày',
       days: 'ngày'
   }
Added in, sorry about the delay. cqm 10:25, 21 Jun 2014 (UTC)

Multiple counters on same page

I am using two counters on the same page that count down to different end dates.  But when I specify an date-end for one of them, the other ends at the same time.  Is there a way to make each counter independent of the other for the end conditions?

Cornbread4 (talk) 13:35, May 23, 2014 (UTC)Cornbread4

Have you tried:
<span data-end="remove" class="countdown" style="display:none;">
 Only <span class="countdowndate">January 01 2015 00:00:00</span> until the new year...

 Only <span class="countdowndate">January 01 2016 00:00:00</span> until the next new year...
</span>
The source appears to support this, but I have not tested it. -452 (talk) 13:46, May 23, 2014 (UTC)
It removes both times once the first date has passed. I'm trying to think of a way to set them up as unique entries wihout having to embed another page, but no luck so far.
Cornbread4 (talk) 14:13, May 25, 2014 (UTC)Cornbread4
Oh, I understand what you mean now, sorry.
I also see the problem:
c.remove();
"c" is the .countdown span rather than the .countdowndate span - it should probably be changed to :
countdowns[i].node.remove();
For now, you should be able to sidestep the problem by changing "remove" to "stop" which should stop the first countdown while allowing the second to continue.
Again, I haven't tested any of this, so this information might be incorrect. -452 (talk) 22:42, May 25, 2014 (UTC)

Countdown Template

I don't know if this is useful to anyone else, but I created a template on the Clash of Clans wiki that makes it a little easier for folks to add countdowns to their pages. I'm happy to include it here if you would want to make it part of the countdown page. It requires this code but defaults a lot of the more popular options. The link is here: w:c:clashofclans:Template:Countdown 60px-Spsig.png (talk) 12:30, May 25, 2014 (UTC-8)

BUG: multiple countdowns on page may throw exception

There appears to be a bug if there are multiple countdowns on a page where an ended (i.e. any behaviour other than to continue counting up) timer is followed by at least one other live timer later on the page. A JS exception will be thrown which kills all subsequent updates for all remaining live timers on the page. This may be related to issue described by Cornbread4 above.

The sequence of events for a page with timers A and B is as follows:

  • A and B are initially both ticking down, although A is approaching end
  • On the first update() after passing the end time for A, iterate over countdowns = [ A, B ], find that A is ended, and call end(0)
  • end(0) performs appropriate action to end that timer, then removes A from countdowns, leaving countdowns = [ B ], and returns
  • Iterator in update() continues to B, and calls end(1) because the array being iterated over is still [ A, B ]
  • end(1) throws an exception as soon as it tries to access countdowns[1]
  • uncaught exception kills update() prematurely, and the next tick will not fire

Propose a fix whereby end(n) returns a value indicating whether or not that timer should be removed from countdowns instead of simply splicing countdowns. update() can splice countdowns to remove any ended timers after the iterator is finished. --Asaba (talk) 19:56, June 15, 2014 (UTC)

Here's a fixed version of the end(n) and update() functions:
    function end(i) {
       var c = countdowns[i].node.parent();
       switch (c.attr('data-end')) {
           case 'remove':
               c.remove();
               return true;
           case 'stop':
               output(i, 0);
               return true;
           case 'toggle':
               var toggle = c.attr('data-toggle');
               if (toggle && $(toggle).length) {
                   $(toggle).css('display', 'inline');
                   c.css('display', 'none');
                   return true;
               }
               break;
           case 'callback':
               var callback = c.attr('data-callback');
               if (callback && $.isFunction(module[callback])) {
                   output(i, 0);
                   module[callback].call(c);
                   return true;
               }
               break;
       }
       countdowns[i].countup = true;
       output(i, 0);
       return false;
   }
   
   function update () {
       var now = Date.now();
       var countdownsToRemove = [];
       $.each(countdowns.slice(0), function (i, countdown) {
           var diff = Math.floor((countdown.date - now) / 1000);
           if (diff <= 0 && !countdown.countup) {
               if (end(i)) countdownsToRemove.push(i);
           } else {
               output(i, Math.abs(diff));
           }
       });
       var x;
       while((x = countdownsToRemove.pop()) != null) {
           countdowns.splice(x, 1);
       };
       if (countdowns.length) {
           window.setTimeout(function () {
               update();
           }, 1000);
       }
   }
--Asaba (talk) 02:08, June 20, 2014 (UTC)
Your explanation of the issue seems sensible, I couldn't see anything in the code that selected more than one timer but this is the first time anyone has noticed the exception. I'll try to test this tomorrow and then hopefully merge it if it works ok. cqm 09:27, 20 Jun 2014 (UTC)
Seems to be working as expected, so I've merged in your fix along with the vietnamese translations posted above some time ago :) cqm 10:22, 21 Jun 2014 (UTC)

Time/Date Display Format

Would it be possible to display the timer in a customized format? i.e. 10 days, 23:59:59 compared to the default 10 days, 23 hours, 59 minutes, 59 seconds.

That's just one example. There's tons of formatting for times & dates though... --Lloyd Dunamis (talk) 06:05, June 17, 2014 (UTC)

It's something that's been oft requested above. It looks like Pecoes was planning on doing something like that, but he disappeared some time ago. I'm only doing bugfixes and i18n updates for the time being, but if someone wants to have a go at implementing it they're free to :) cqm 10:27, 21 Jun 2014 (UTC)

Not working/nothing displayed

I can't get this to work over on the homepage of w:c:findingcarter. I implemented the JS where needs be, and I've tried and tried with the timezone and everything else… I can't even get it to work without being edited. —Liz 03:52, April 9, 2015 (UTC)

Remove the "var " from in front of "countdownTimer.translations" on line 8. You cannot (and don't need to) declare an object property using the "var" keyword. — Foodbandlt (talk) 05:03, April 9, 2015 (UTC)
Actually, that entire statement doesn't need to be there unless you want to override the words that are displayed. At the moment you have it set to use the default. So the only thing you need in your Common.js is the importArticles statement. — Foodbandlt (talk) 05:09, April 9, 2015 (UTC)
I removed it; I forgot I had it there. >.> Thanks. —Liz 13:13, April 9, 2015 (UTC)

Multiple Countdown clocks might display the end message if one of them ended earlier.

My Usage Code in a template:

<span data-end="toggle" data-toggle=".post-countdown" class="countdown" style="display:none;"> {{{Start Prefix}}} <span class="countdowndate">{{{Date}}} {{{Time}}} -0700</span> {{{Start Suffix}}}</span> <span class="post-countdown" style="display:none;">{{{End}}}</span>

Jianmingyong (talk) 14:04, June 15, 2015 (UTC)

Broken

When I try to use this script, I get the following error: Uncaught TypeError: Cannot read property 'split' of undefined

Rider ranger47 02:35, August 2, 2015 (UTC)

It is working on our wiki, just tested. Can you show where it happens? The countdown code itself doesn't contain any "split", so it can be another script causing the problem. - Tjcool007 (Talk) 09:12, August 2, 2015 (UTC)
It turns out it was a different script. Sorry for the confusion. Rider ranger47 17:57, August 2, 2015 (UTC)

New translations

Hello! Here are the translations for Arabic, Greek and Romanian. I would have added them myself, but I am getting this error: You can not perform this action right now. Please try again in a few minutes, or contact Wikia if you are having difficulties.

Here they are:

// Arabic (العربية)
    	ar: {
    	    and: 'و',
            second: 'ثانية',
            seconds: 'ثواني',
            minute: 'دقيقة',
            minutes: 'دقائق',
            hour: 'ساعة',
            hours: 'ساعات',
            day: 'يوم',
            days: 'أيام',
    	},
 
// Greek (Ελληνικά)
        el: {
            and: 'και',
            second: 'δευτερόλεπτο',
            seconds: 'δευτερόλεπτα',
            minute: 'λεπτό',
            minutes: 'λεπτά',
            hour: 'ώρα',
            hours: 'ώρες',
            day: 'ημέρα',
            days: 'ημέρες',
        },
 
// Romanian (Română)
        ro: {
            and: 'și',
            second: 'secundă',
            seconds: 'secunde',
            minute: 'minut',
            minutes: 'minute',
            hour: 'oră',
            hours: 'ore',
            day: 'zi',
            days: 'zile',
        },

--Star Warden-- 18:02, October 31, 2015 (UTC)

Added - thank you for translating! - OneTwoThreeFall (talk) 12:24, August 3, 2016 (UTC)

It doesn't show anything

I need help to install the countdown on my wiki, i left the next code on the common.js page

importArticles({
    type: "script",
    articles: [
        "w:c:dev:Countdown/code.js"
    ]
});

and then used to use the countdown on a template

but it doesn't show anything, can anyone please tell me what is missing or help me to put it correctly on my wiki? --EB97-217 (talk) 11:04, November 26, 2015 (UTC)

Did you have "<span class="countdown" style="display:none;">Only <span class="countdowndate">January 01 2016 00:00:00</span> until the new year...</span>"?
~Curiouscrab (talk) 14:43, November 26, 2015 (UTC)
Yes, i did and still nothing :(
In w:c:es.how-to-get-away-with-murder:mediawiki:common.js, remove the first line ("MediaWiki:Common.js"), so that the import actually works. slyst (talk) 05:49, November 27, 2015 (UTC)
Thanks, i removed and still nothing. Can you help me, please? I have these two templates w:c:es.how-to-get-away-with-murder.wikia.com/wiki/Plantilla:Contador, w:c:es.how-to-get-away-with-murder.wikia.com/wiki/Plantilla:NEcountdown made for the countdown but i don't know what's the problem.—Preceding unsigned comment added by EB97-217 (talkcontribs) . Please sign your posts with ~~~~!
It seems to be a loading issue. If you copy the code from Countdown/code.js and paste it in the console and run it, it works just fine. I searched the imports and it isn't be imported anywhere. I checked the sources folder with the developer tools, and it's definitely not there. Try this:
importScriptPage('Countdown/code.js','dev');

~Curiouscrab (talk) 20:55, November 29, 2015 (UTC)
Thank you so much! :D EB97-217 (talk) 05:54, November 30, 2015 (UTC)
It works fine now, but nothing is loaded on your part because you've neither submitted your edit for review nor you're in test mode. You would need to submit the latest revision to make the js public. Meanwhile, you can enter the test mode to see the countdown working; the button to enter test mode is also on the same page. - slyst (talk) 02:27, November 30, 2015 (UTC)
Thank you so much, i submitted my edit for review now and now that i saw the test mode i could make some editing into my template, now i have to wait. Do you know how much takes to be accepted or denied, and in case of being denied what can i do? EB97-217 (talk) 05:54, November 30, 2015 (UTC)
Imports from the dev wiki are considered safe, so you don't have to worry about the revision getting denied. - slyst (talk) 07:46, November 30, 2015 (UTC)

Doesn't work

I don't really get it, I have no leading zeros and it to display on EST time but it doesn't do anything. (It's still localized) The timer is here.

edit: I think I managed to fix the localized time, but leading zeros aren't removed.¿
VosavoTalkContributions
The essence of your mind is intrinsically pure.
16:32, April 10, 2016 (UTC)

Turkish Localisation

 tr: {
       and: 've',
       second: 'saniye',
       seconds: 'saniye',
       minute: 'dakika',
       minutes: 'dakika',
       hour: 'saat',
       hours: 'saat',
       day: 'gün',
       days: 'gün'
   }

—Preceding unsigned comment added by Zoevause (talkcontribs) 20:50, August 1, 2016 (UTC)‎. Please sign your posts with ~~~~!

Added - thank you for translating! - OneTwoThreeFall (talk) 12:24, August 3, 2016 (UTC)

Thanks!

Darren

Hello

I cannot seem to add a space between the prefix words and the countdown. Please help me


Darren

Support for MediaWiki:ImportJS

Support for MediaWiki:ImportJS

to get this working in ImportJS, you need to add it like this:

dev:Countdown/code.js

if you try to add it as just "dev:Countdown.js" like some other includes, it won't work Kushieda minori (talk) 04:15, December 1, 2016 (UTC)

Usage example

Did someone manage to use the script and can link toward the wiki?

Thanks.

Tagalog (tl) translation

countdownTimer.translations = { 
    tl: {
        and: 'at',
        second: 'segundo',
        seconds: 'mga segundo',
        minute: 'minuto',
        minutes: 'mga minuto',
        hour: 'oras',
        hours: 'mga oras',
        day: 'araw',
        days: 'mga araw'
    }
};

--AStranger195 (talkcontribsguestbook) 13:01, January 20, 2018 (UTC)

I added it now to the code. -- Cube-shaped garbage can 17:04, January 20, 2018 (UTC)

Script does not stop once the countdown is finished and instead counts back up

I recently removed some JavaScript on one of the wikis I administrate, and as I predicted - due to experiencing the same thing on another wiki - the script started to count back up once the timer had expired. Instead of counting back up, I wanted it to say "Timer has expired". But I'm not sure how to do that. ― C.Syde (talk | contribs) 02:41, March 28, 2018 (UTC)

See the Countdown#Replacement section in the docs - seems like what you're looking for. - OneTwoThreeFall talk 03:07, March 28, 2018 (UTC)
I just hope I can get it to do what I want. ― C.Syde (talk | contribs) 03:24, March 28, 2018 (UTC)
I'm not sure how to get it to work though. I'm finding it hard to imagine how to code it since it seems quite different from what I use. ― C.Syde (talk | contribs) 12:04, March 28, 2018 (UTC)
That was a bit tricky because, since you're using a template, multiple countdowns needed a different selector each for the data-toggle attribute. I've made a backward-compatible edit to solve it. Now you only need to use the data-toggle="next" attribute, no need to worry about selectors. Once it is approved, try this:
<span class="countdown" style="display:none;" data-end="toggle" data-toggle="next">
  <span class="countdowndate">{{{time}}} {{{zone}}}</span>
</span>
<span style="display:none;">{{{end message|}}}</span>
As you can see, you'll have to add the end message parameter every time the template is called. If you don't, the countdown will just disappear once the date is reached. Jorgemg14 (talk) 12:50, March 28, 2018 (UTC)
If you check the edit history of the template that I linked, I just made a change so that it can't count up once the timer has expired. However, I'm not sure how to make the counter say "Timer has expired" when finished. Instead it says "0 days, 0 hours, 0 minutes and 0 seconds". ― C.Syde (talk | contribs) 23:15, March 28, 2018 (UTC)
I needed some help to do it, but it's been handled now! :) ― C.Syde (talk | contribs) 03:39, March 29, 2018 (UTC)
Not really. Try adding two countdowns in the same page, one of them with a past date and the other with a future date. The first will work well but the latter will show "X days, X hours, X minutes and X seconds Timer has expired".
To solve this, go to your template and replace data-toggle=".post-countdown" by data-toggle="next". You can also delete class="post-countdown" since it is not needed anymore.
Note that, as it happened to me, you'll probably need to clear your cache to get the last update of the countdown code. Jorgemg14 (talk) 13:14, March 29, 2018 (UTC)
How's this? ― C.Syde (talk | contribs) 20:37, March 29, 2018 (UTC)
Nah, that didn't work. ― C.Syde (talk | contribs) 20:40, March 29, 2018 (UTC)
Yes, it did work, I tested it myself. Just make sure you have cleared your device's cache to get the update. As you have it now, if one countdown expires, all the countdowns of the page will show both the missing time and the "Timer has expired" message, which is not how it should work. Jorgemg14 (talk) 15:19, March 30, 2018 (UTC)
Do you think you could show me precisely what it should look like, in order for it to work? ― C.Syde (talk | contribs) 22:25, March 30, 2018 (UTC)
I'm linking the sandbox of my wiki, in-case that helps anyone with responding to my messages, and in-case anyone will then be able to tell me what I need to do to fix the template. ― C.Syde (talk | contribs) 11:26, March 31, 2018 (UTC)
I've edited your Countdown Template, now both countdowns on your sandbox are working properly. Jorgemg14 (talk) 12:28, March 31, 2018 (UTC)
Thanks! :D ― C.Syde (talk | contribs) 23:53, March 31, 2018 (UTC)

Only Display Days

Is it possible to make the counter only show, for example, the number of days left, and hide hours, minutes, and seconds?—|| Grudgeholderr ||— 19:50, April 1, 2018 (UTC)

Would also be interested in this feature. —Scott (message me) 11:09, March 19, 2019 (UTC)
Found a solution at w:c:community:Thread:1634697. —Scott (message me) 12:04, March 19, 2019 (UTC)

Russian plurals

Hi, I'd like to suggest a correction for the Russian language; I'm not sure if it's automatically implemented by the module.

Russian has two different plural forms: for 2–4 and for >= 5. I've only seen the forms for >= 5 in the language list, so I don't think the translation module does it automatically, does it? If not, here's the word forms to add if translations == ru.

I've added units2to4 parameters for the 2–4 values. Polish has the same phenomenon (like many Slavonic languages), but here someone has added a workaround by adding parentheses. This does not work in Russian because the plural suffix is sometimes not only added, but replaces another suffix. I've changed the Polish parameters as well.

You'd have to add a handler for these languages later in the code. I think Polish and Russian users would be happy to see their countdown with correct plural forms. :-)

		// Russian (русский)
		ru: {
			and: 'и',
			second: 'секунда',
			seconds2to4: 'секунды',
			seconds: 'секунд',
			minute: 'минута',
			minutes2to4: 'минуты',
			minutes: 'минут',
			hour: 'час',
			hours2to4: 'часа',
			hours: 'часов',
			day: 'день',
			days2to4: 'дня'
			days: 'дней'
		},
		// Polish (Polski)
		pl: {
			and: 'i',
			second: 'sekunda',
			seconds2to4: 'sekundy',
			seconds: 'sekund',
			minute: 'minuta',
			minutes2to4: 'minuty',
			minutes: 'minut',
			hour: 'godzina',
			hours2to4: 'godziny',
			hours: 'godzin',
			day: 'dzień',
			days2to4: 'dni'
			days: 'dni'
		},

Guy Bukzi Montag (talk) 00:57, October 1, 2019 (UTC)

I've seen that there are more Slavonic languages in the list. I you want, I can provide the correct plural forms for them, too. Guy Bukzi Montag (talk) 01:12, October 1, 2019 (UTC)

Importing the localized version of the script

Hey there. Is there a way I could import a version of this script that is localized in Serbian directly to a Wiki? I can only think of copying the full code from the code.js page of this script to the Wiki's Wikia.js and then removing all other languages and just leaving Serbian, but there must be a faster way, right? If there is, please help me out. Means a lot. Thank you! 😊

Community content is available under CC-BY-SA unless otherwise noted.

Fandom may earn an affiliate commission on sales made from links on this page.

Stream the best stories.

Fandom may earn an affiliate commission on sales made from links on this page.

Get Disney+