2019-05-02 23:45:10 +02:00
import setupListeners from './js/setupListeners' ;
2019-05-03 18:34:11 +02:00
import { renderAll } from './js/render' ;
2019-06-06 01:34:56 +02:00
import { hasToken , addMessage } from './js/utilities' ;
2019-05-08 23:23:46 +02:00
import { loadDictionary } from './js/dictionaryManagement' ;
2019-05-09 22:24:47 +02:00
import { loadSettings } from './js/settings' ;
2019-06-04 19:11:58 +02:00
import { setupAds } from './js/ads' ;
2019-05-02 23:45:10 +02:00
2019-05-02 18:57:56 +02:00
function initialize ( ) {
2019-06-06 01:34:56 +02: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-05-23 23:26:13 +02:00
loadSettings ( ) ;
2019-06-06 01:28:49 +02:00
loadDictionary ( ) ;
2019-05-23 23:26:13 +02:00
setupListeners ( ) ;
2019-05-22 00:29:05 +02:00
if ( hasToken ( ) ) {
import ( './js/account/index.js' ) . then ( account => {
account . loginWithToken ( ) ;
} ) ;
}
2019-06-04 19:11:58 +02:00
2019-06-06 19:25:08 +02:00
setupAds ( ) ;
renderAll ( ) ;
2019-05-02 18:57:56 +02:00
}
window . onload = ( function ( oldLoad ) {
2019-06-06 19:25:08 +02:00
oldLoad && oldLoad ( ) ;
initialize ( ) ;
2019-05-02 18:57:56 +02:00
} ) ( window . onload ) ;