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});
|
2018-05-11 12:31:53 +02:00
|
|
|
var messaging = Messaging();
|
|
|
|
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-01-01 12:57:27 +01:00
|
|
|
var login = Login({dom: dom, i18n: i18n, messaging: messaging, room: room, screen: screen, session: session});
|
2018-05-16 22:59:22 +02:00
|
|
|
var hanafuda = Hanafuda({fun: fun});
|
2019-01-13 20:01:55 +01:00
|
|
|
var game = Game({async: async, dom: dom, i18n: i18n, fun: fun, hanafuda: hanafuda, messaging: messaging, room: room, screen: screen, session: session});
|
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();
|
|
|
|
});
|