From 2798242dec1020c57a0a5c14079b1ece6e3ee707 Mon Sep 17 00:00:00 2001 From: Tissevert Date: Fri, 27 Dec 2019 08:42:36 +0100 Subject: [PATCH] Put text initialization back into login module --- www/main.js | 5 +---- www/screen/login.js | 7 ++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/www/main.js b/www/main.js index 97bd9a4..bfd31c5 100644 --- a/www/main.js +++ b/www/main.js @@ -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) { diff --git a/www/screen/login.js b/www/screen/login.js index a14e454..6cd85fa 100644 --- a/www/screen/login.js +++ b/www/screen/login.js @@ -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); }