Christian Heilmann

JavaScript countdown solution

Tuesday, February 5th, 2008 at 4:44 pm

This is not going to be amazing, but I had to find / write a script like that for every hackday / barcamp I attended so far. Being lazy, I just wanted to create one I can re-use later on. So here you are:

You can either use the counter directly, or right-click and save it for local use. The look and feel is all in the CSS, yo u can set some of the preferences in the counter interface and there are several configuration settings you can change:


var cfg = {
displayID:’display’, // element to show the seconds
startButtonID:’c’, // start button ID
pauseButtonID:’p’, // pause button ID
finalClass:’final’, // class to add when final coutdown is reached
overClass:’over’, // class to add when the time is over
initialText:{
value:’2:00’,
label:’Initial Text’
},
seconds:{
value:2*60,
label:’Time in Seconds’
},
finalCountdown:{
value:30,
label:’Time when the warning starts’
},
pauseLabel:{
value:’pause’,
label:’Pause Text’
},
resumeLabel:{
value:’resume’,
label:’Resume Text’
}

};

Some configuration settings have values and labels, this is because of the preferences form being created from this object.

As said, nothing special, but I hope you can use it, I know I will.

Tags: , , ,

Share on Mastodon (needs instance)

Share on Twitter

Newsletter

Check out the Dev Digest Newsletter I write every week for WeAreDevelopers. Latest issues:

160: Graphs and RAGs explained and VS Code extension hacks Graphs and RAG explained, how AI is reshaping UI and work, how to efficiently use Cursor, VS Code extensions security issues.
159: AI pipelines, 10x faster TypeScript, How to interview How to use LLMs to help you write code and how much electricity does that use? Is your API secure? 10x faster TypeScript thanks to Go!
158: 🕹️ Super Mario AI 🔑 API keys in LLMs 🤙🏾 Vibe Coding Why is AI playing Super Mario? How is hallucinating the least of our worries and what are rules for developing Safety Critical Code?
157: CUDA in Python, Gemini Code Assist and back-dooring LLMs We met with a CUDA expert from NVIDIA about the future of hardware, we look at how AI fails and how to play pong on 140 browser tabs.
156: Enterprise dead, all about Bluesky and React moves on! Learn about Bluesky as a platform, how to build a React App and how to speed up SQL. And play an impossible game in the browser.

My other work: