Ported coffee charts to js


Signed-off-by: Sheik Hassan <solergiga@yahoo.com>
Move declaration of `tok` out of loop