We can't share code because the client uses XHR and the server uses Node's
HTTP/HTTPS libraries, but we're now sharing a lot of the API, which should
make it more familiar.
This should make PS marginally slower on really old browsers,
marginally faster on modern browsers, neither of which should be
remotely noticeable.
The intended actual impact is to make it easier to maintain
(`battle-dex` is clearly the wrong place for polyfills) and easier
to reuse outside of PS.
SockJS-client _still_ isn't compatible with NW.js, leading to the
workaround we're currently using. The workaround breaks the
source-map, so there's been the source-map error unnecessarily
cluttering our consoles this entire time.
* Use SockJS' timeout config option
This sets timeouts on connections to 5 minutes, matching the server's
heartbeat interval to close sockets that shouldn't be open anymore.
* Update SockJS client to v1.4.0
This fixes an issue where SockJS would parse the entire HTTP response
received as JSON, not the response's body alone.
We now just use JSON.parse and JSON.stringify - it's supported by all
browsers supported by the client.
Tools.safeJSON has also been moved to Storage.safeJSON, since it's not
used in replays at all.
jslider was incredibly buggy, and most likely the cause of the problems
with the teambuilder on mobile, and required some pretty ridiculous
hacks, and leaked memory.
We're now using HTML5 sliders, like we are with the volume controls.
HTML5 sliders aren't supported by IE9, but they're supported by most
other browsers PS cares about. If not, well, they won't look too ugly
probably...
When loading a background, we use Color Thief to get a six-color
palette from the image, for use on the main menu buttons.
Only hue and lightness are extracted.
https://github.com/lokesh/color-thief/
Backgrounds are now stored in localStorage in the current origin,
rather than the prefs origin. This allows faster loading, as well
as different backgrounds for different origins, which other
servers should like since it means their backgrounds get seen
at least once before possibly being replaced.
Special thanks to Joim for the base code.