Put text initialization back into login module

This commit is contained in:
Tissevert 2019-12-27 08:42:36 +01:00
parent e9548e9a22
commit 2798242dec
2 changed files with 5 additions and 7 deletions

View file

@ -11,16 +11,13 @@ window.addEventListener('load', function() {
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 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 = {
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) {

View file

@ -5,7 +5,7 @@ Screen.Login = function(modules) {
return {};
function init() {
initDOMEvents();
initDOM();
initMessageHandlers();
var name = modules.save.get('player.name');
if(name != undefined && name.length > 0) {
@ -14,12 +14,13 @@ Screen.Login = function(modules) {
}
}
function initDOMEvents() {
function initDOM() {
form.getElementsByTagName('label')[0].textContent = modules.i18n.get('pickName');
form.join.value = modules.i18n.get('join');
form.addEventListener('submit', function(e) {
e.preventDefault();
modules.session.start(form.you.value);
});
form.you.addEventListener("input", validate);
}