Make console.log statements conditional; minor refactoring

PROBLEM: There are console.log statements galore within our code base, and this is problematic due to the following points: 

- We shouldn't show clients any debug info which is meant for devs' eyes only.
- It pollutes the code, and henceforth diminishes readability
- It breaks the JS behaviour in certain (old) browsers, including, but possibly not limited to, IE 8-

SOLUTION: make console.log statements conditional, the condition being based on the current environment in which the app runs (::= development | production | ...). 

This value is subsequently (i) written to base.html by Django, (ii) read from that exact same part of the code by the JS (on load from base.html), written to a globally accessible JS variable (window.JS_DEBUG) which can then (iv) be used all over the place to prevent debug info from being printed.

TODO: (this line is intentionally left blank)