web/javascript.js: minor refactoring