2018-05-11 12:31:53 +02:00
|
|
|
window.addEventListener('load', function() {
|
|
|
|
var dom = Dom();
|
2019-01-13 20:01:55 +01:00
|
|
|
var async = Async();
|
2019-01-01 12:57:27 +01:00
|
|
|
var translations = Translations();
|
|
|
|
var i18n = I18n({translations: translations});
|
2018-05-13 18:08:12 +02:00
|
|
|
var fun = Fun();
|
2019-11-24 22:56:00 +01:00
|
|
|
var save = Save();
|
2019-01-01 12:57:27 +01:00
|
|
|
var screen = Screen({dom: dom, i18n: i18n});
|
2019-10-18 17:55:50 +02:00
|
|
|
var messaging = Messaging({screen: screen});
|
2019-11-24 22:56:00 +01:00
|
|
|
var session = Session({messaging: messaging, save: save});
|
2018-05-13 18:08:12 +02:00
|
|
|
var room = Room({dom: dom, messaging: messaging, session: session, fun: fun});
|
2019-08-12 14:04:57 +02:00
|
|
|
var statusHandler = StatusHandler();
|
2019-12-11 22:03:16 +01:00
|
|
|
var login = Screen.Login({dom: dom, i18n: i18n, messaging: messaging, room: room, save: save, screen: screen, session: session, statusHandler: statusHandler});
|
|
|
|
var hall = Screen.Hall({dom: dom, i18n: i18n, messaging: messaging, room: room, save: save, screen: screen, session: session, statusHandler: statusHandler});
|
2018-05-16 22:59:22 +02:00
|
|
|
var hanafuda = Hanafuda({fun: fun});
|
2019-12-11 22:03:16 +01:00
|
|
|
var game = Screen.Game({async: async, dom: dom, i18n: i18n, fun: fun, hanafuda: hanafuda, messaging: messaging, room: room, screen: screen, session: session, statusHandler: statusHandler});
|
2019-01-01 12:57:27 +01:00
|
|
|
|
|
|
|
var domElems = {
|
|
|
|
join: document.getElementById('login').join,
|
2019-12-08 23:01:24 +01:00
|
|
|
invite: document.getElementById('room').invite,
|
|
|
|
//leave: document.getElementById('login').leave,
|
2019-01-01 12:57:27 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2018-05-11 12:31:53 +02:00
|
|
|
});
|