PEP8: remove noise from E26
Web UI: Remove unnecessary :selected in JavaScript code
Web UI: Use namespace to avoid polluting the global JavaScript namespace
Web UI: Move JavaScript code to display results to a separate function

This eases understanding of code and reduces indent levels.