CSP Compatibility

Fixed CSP compatibility problems causing inline JavaScript to not be executed. All inline script has been removed and event handlers are bound in imported code once the DOM is ready.