Where do I add my custom JavaScript code?

Navigate to the options panel Advanced → Global Settings, where you'll find two provided sections to add scripts.