Where are you implementing the JavaScript? in the Master Page?
I would think an easier route would be to use some jQuery on the Init Block to make sure there isn't some element of the DOM showing up on the page. For instance, when in Page Edit mode Kentico tacks on the cmsedit.js file. You could look for that and if present not perform the Init block of code.
That is just an example, you could also use the container that holds the page in the page edit interface, etc. This would be much less impactful on your system vs a macro and be easy to implement. We do this type of look often in both Kentico and non-Kentico type systems.