Refactoring of javascript started
Remove ununsed code
Moved almost all js to modules
Complete JS refactoring

Also fixes #186
Done, for real
Manually merge branch 'js-fixes'

Conflicts:
	templates/api.djhtml
	templates/index.djhtml