window.addEventListener('load', function() { var dom = unitJS.Dom(); var async = unitJS.Async(); var fun = unitJS.Fun(); var translations = Translations(); var i18n = I18n({translations: translations}); var save = Save(); var screen = Screen({dom: dom, i18n: i18n}); var messaging = Messaging({screen: screen}); var ui = Ui({messaging: messaging}); var session = Session({messaging: messaging, save: save}); var room = Room({dom: dom, session: session, fun: fun}); var statusHandler = StatusHandler(); var login = Screen.Login({i18n: i18n, messaging: messaging, save: save, screen: screen, session: session, ui: ui}); var hall = Screen.Hall({dom: dom, i18n: i18n, messaging: messaging, room: room, save: save, screen: screen, session: session, statusHandler: statusHandler, ui: ui}); var hanafuda = Hanafuda({fun: fun}); var game = Screen.Game({async: async, dom: dom, i18n: i18n, fun: fun, hanafuda: hanafuda, messaging: messaging, room: room, screen: screen, session: session, statusHandler: statusHandler}); var domElems = { invite: document.getElementById('room').invite, startGameWith: document.getElementById('invite').getElementsByTagName('label')[0] }; for(var key in domElems) { switch(domElems[key].tagName.toLowerCase()) { case 'input': domElems[key].value = i18n.get(key); break; default: domElems[key].textContent = i18n.get(key); } } });