32 lines
1.6 KiB
JavaScript
32 lines
1.6 KiB
JavaScript
window.addEventListener('load', function() {
|
|
var dom = unitJS.Dom();
|
|
var async = unitJS.Async();
|
|
var translations = Translations();
|
|
var i18n = I18n({translations: translations});
|
|
var fun = Fun();
|
|
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({dom: dom, i18n: i18n, messaging: messaging, room: room, save: save, screen: screen, session: session, statusHandler: statusHandler, 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 = {
|
|
join: document.getElementById('login').join,
|
|
invite: document.getElementById('room').invite,
|
|
//leave: document.getElementById('login').leave,
|
|
pickName: document.getElementById('join').getElementsByTagName('label')[0],
|
|
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);
|
|
}
|
|
}
|
|
});
|