js: refactor measurement function to hash
js: refactor OpenCloset method to attribute