Refactor script.js to suppress error

The navigation-pinning code was producing JS errors on non-activity pages, so this shuts it off if there's no navigation to pin. Also, some variable renaming to be more Javascripty.
Fixing test we broke for save-on-change.js