Move nested functions and callbacks outside callbacks
Move nested functions and callbacks outside callbacks

Simplify code structure. There is no need to have nested callbacks and
functions inside other callbacks.

Move `chrome.webRequest.onErrorOccurred` callback outside `onMessage`
callback to simplify it.

Move right click context menus outside callbacks.

Fix code formating of `chrome.webRequest.onCompleted.addListener`.

internetarchive/wayback-machine-chrome,internetarchive/wayback-machine-chrome