Use asynchronous requests to load palettes

It's better to use AJAX to load palettes rather than pre-loading all
palettes. Also, use a cleaner way to get data out of the palettes in
pal2js.py.