Currently our JS is scattered among various source files that only vaguely represent the client side's structure.
Also, panel-specific code should check if its panel is present (document.getElementById("the-panel-s-id") returns the element) and only continue if it is, instead of throwing errors.