js: refactor as html, css and js