[cleanup] Refactored the measurements JS code as a Prototype.js class