Rewrite JS to use requirejs

This is because I _someday_ plan to have plug-and-play panels.