Js fix

restructured the js as a class and use `keyup` events to trigger count update, which's more efficient than timer callbacks.

see https://github.com/GigaOM/gigaom/issues/5767
`===` for the undefined check.