Hopefully fix race condition in popup list generation
Hopefully fix race condition in popup list generation

My knowledge of JavaScript is limited, but it looks like we have a race
condition on the update of the global variable used for storing the
subset of languages to use when generating the list in the popup.

Turn this global into a local variable passed to the function that
generates the list. Make loadJSON() a bit less generic (now it does not
take a callback as argument, it simply knows it should call the function
for generating the list), and pass it the subset of languages instead so
it can forward it to list generation callback.

On a short test, this seems to address the popup being sometimes empty
on Linux (and always on Windows?) as described in issue #14.

Qeole/Enlight,Qeole/Enlight,Qeole/Enlight