2019-06-09 12:57:28 -06:00
import migrate from './js/migration' ;
2019-05-02 15:45:10 -06:00
import setupListeners from './js/setupListeners' ;
2019-05-03 10:34:11 -06:00
import { renderAll } from './js/render' ;
2019-06-05 17:34:56 -06:00
import { hasToken , addMessage } from './js/utilities' ;
2019-05-08 15:23:46 -06:00
import { loadDictionary } from './js/dictionaryManagement' ;
2019-05-09 14:24:47 -06:00
import { loadSettings } from './js/settings' ;
2019-06-04 11:11:58 -06:00
import { setupAds } from './js/ads' ;
2019-05-02 15:45:10 -06:00
2019-05-02 10:57:56 -06:00
function initialize ( ) {
2019-06-05 17:34:56 -06:00
if ( window . isOffline ) {
addMessage ( '<strong>You are using the Offline version of Lexiconga.</strong><br>Refresh the page while connected to the internet to enable using accounts.' , 0 ) ;
}
2019-06-09 12:57:28 -06:00
migrate ( ) ;
2019-05-23 15:26:13 -06:00
loadSettings ( ) ;
2019-06-05 17:28:49 -06:00
loadDictionary ( ) ;
2019-05-23 15:26:13 -06:00
setupListeners ( ) ;
2019-05-21 16:29:05 -06:00
if ( hasToken ( ) ) {
import ( './js/account/index.js' ) . then ( account => {
account . loginWithToken ( ) ;
} ) ;
}
2019-06-04 11:11:58 -06:00
2019-06-06 11:25:08 -06:00
setupAds ( ) ;
renderAll ( ) ;
2019-05-02 10:57:56 -06:00
}
window . onload = ( function ( oldLoad ) {
2019-06-06 11:25:08 -06:00
oldLoad && oldLoad ( ) ;
initialize ( ) ;
2019-05-02 10:57:56 -06:00
} ) ( window . onload ) ;