Factor out some JS from options page to meet Chrome extension reqs