Use ruler with javascript