Decouple prefs

Joining in on the preferencesModel refactoring....

* Have PHP/server generate JSON to be consumed by JS/client instead of having PHP generate JS code to be executed. This is the motivation for this whole thing: separating JS from PHP.

* Load prefs when needed rather than onDomReady, keeping the code that uses the prefs close to the code that loads the prefs, reducing "magic".

* Preferences data is dead simple, so simplify code by using native JSON implementations for more understandable code.

* Use object to hold private vars in JS `PreferencesModel` object. Since it's a JS object/PHP associative array everywhere else, this just keeps it all consistent.