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-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});
|
2018-05-11 12:31:53 +02:00
|
|
|
var session = Session({messaging: messaging});
|
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();
|
|
|
|
var login = Login({dom: dom, i18n: i18n, messaging: messaging, room: room, screen: screen, session: session, statusHandler: statusHandler});
|
2018-05-16 22:59:22 +02:00
|
|
|
var hanafuda = Hanafuda({fun: fun});
|
2019-08-12 14:04:57 +02:00
|
|
|
var game = 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,
|
|
|
|
invite: document.getElementById('login').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);
|
|
|
|
}
|
|
|
|
}
|
2018-05-11 12:31:53 +02:00
|
|
|
|
|
|
|
messaging.start();
|
|
|
|
});
|