SimpleCounter 0.3.4

A simple counter that counts how much time remains/passed from a spcified date and time. The class was inspired by a joomla pugin called util_counter, which can be found here



Details

Author
Arieh Glazer
Current version
0.3.4
GitHub
arieh/SimpleCounter
Downloads
24315
Category
Interface
Tags
Report
GitHub Issues

Releases


Dependencies

  • _self_/_current_: core/1.3 : [Class, Class.Extras, Element]

How to use

<div id='res'></div>

Then the JS:

var counter = new SimpleCounter('res',new Date(2011,12,1));

Arguments

  1. element (String element id or Element) : An element to inject the counter into.
  2. time (Integer target timestamp or Date target date): A traget date to cout to/from. NOTE: timestamp provided must be in seconds, and not miliseconds.
  3. options - (Object: optional) See below:

Options

  1. format (string) : In what way to format the counter (see more below). default is [D] [H] [M] [S].
  2. lang (object): Alternative words to use or counter. for more detail see source code.
  3. leadingZero (bool): whether to add a leading zero to numbers smaller than 10. default is true.
  4. continue (bool) : whether to start countng upwards when countdown is done. default is false.

Date Format

The class identifies 4 letters: D(days), H(hours), M(minutes), S(seconds) surounded by curly bracets. If the letters are capital, the unit's name will be used allongside the unit's number. Else, if a smal letter is used, only the unit's number will be used.

Examples:

'{D} {h}:{m}:{s}' // 14 Days 10:34:15
'{D}, {H} and {M}' // 14 Days, 10 Hours and 34 Minutes

Events

  • done : Fires when countdown is done

Discuss

A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.

Found a bug in this plugin? Please report it this repository's Github Issues.

blog comments powered by Disqus