Base Drupal 6.11 install with only Time Tracker and Views 2 installed. Garland theme.

After including the file jquery.countdown.js, the timer on the node page (Time tracker block) displays the time for one second then changes to 'undefined' or sometimes alternates between 'undefined' and 'NaN'.

I'm not sure I have the correct jquery.countdown.js file. Here is the contents of the file that I have:

/**
 * jQuery's Countdown Plugin
 *
 * display a countdown effect at given seconds, check out the following website for further information:
 * http://heartstringz.net/blog/posts/show/jquery-countdown-plugin
 *
 * @author Felix Ding
 * @version 0.1
 * @copyright Copyright(c) 2008. Felix Ding
 * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
 * @date 2008-03-09
 * @lastmodified 2008-03-09 17:48    		 
 * @todo error & exceptions handling
*/
jQuery.fn.countdown = function(options) {
	/**
	 * app init
	*/	
	if(!options) options = '()';
	if(jQuery(this).length == 0) return false;
	var obj = this;	

	/**
	 * break out and execute callback (if any)
	 */
	if(options.seconds < 0 || options.seconds == 'undefined')
	{
		if(options.callback) eval(options.callback);
		return null;
	}

	/**
	 * recursive countdown
	 */
	window.setTimeout(
		function() {
			jQuery(obj).html(String(options.seconds));
			--options.seconds;
			jQuery(obj).countdown(options);
		}
		, 1000
	);	

	/**
     * return null
     */
    return this;
}

BrandTim

Comments

hunvreus’s picture

Are there anybody else experiencing the same issue ?

There is a known bug with the jQuery Countdown plug-in that makes countdowns not working when starting from 0, but then when starting from another number it should work fine. Except for that (I am working on it) I can't see other bugs, and can't reproduce your very issue BrandTim.

archnode’s picture

Edited: Is it coincidence that this module works with http://plugins.jquery.com/project/countdown2 ?

steveoliver’s picture

This bug seems to have been fixed for me in the most recent version of the Time Track module.

hunvreus’s picture

@Illithium : what do you mean coincidence? This is just a dependency... What is weird about that? :S

@steveoliver : happy to help, I still need to debug the views and the little bug on the count up when starting at 0.

@BrandTim : any feedback ?

marcus_clements’s picture

@Illithium : what do you mean coincidence? This is just a dependency... What is weird about that? :S

In the README.txt it says :

Go to http://plugins.jquery.com/project/jquery-countdown to download the jQuery Countdown plugin.

But that plugin is just a file and not a zip

I think it should say http://plugins.jquery.com/project/countdown2 and that is the source of the confusion.

edit - When I start the time tracker on a given node for the first time, the numbers dont count up, although when I stop it, the total updates fine. Subsequent starts of the tracker it works fine.

hunvreus’s picture

Thanks, I'll have it changed in the next version.

Regarding the bug, I am aware of that; that is what I meant when said "There is a known bug with the jQuery Countdown plug-in that makes countdowns not working when starting from 0, but then when starting from another number it should work fine. Except for that (I am working on it) I can't see other bugs, and can't reproduce your very issue BrandTim."

Christopher Herberte’s picture

jQuery Countdown2 http://keith-wood.name/countdown.html is GPLed, is there a reason not to include it in the project tarball?

BrandTim’s picture

@hunvreus,

Sorry I didn't respond more quickly - I never received any emails from d.o that this thread had been updated.

The bug I was experiencing was caused because I was using the file at http://plugins.jquery.com/project/jquery-countdown rather than the ones at http://plugins.jquery.com/project/countdown2. Once I switched it started working correctly.

Thanks rayvaughn!
BrandTim

tpainton’s picture

Had the same problem. Countdown2 files solved it. Make sure you clear the cache in performance menu after you update the files otherwise, problem persists.

jziwenchen’s picture

hi, I am jackey.
You can go to http://plugins.jquery.com/project/countdown2 and download the jquery.countdown.package-1.5.2 (Why ? Because It can work in my project.. so...)
And upzip and copy the jquery.countdown.js to the place that the module readme.txt said.

Ok, now it can work well.
lucky!