Put text initialization back into login module
This commit is contained in:
parent
e9548e9a22
commit
2798242dec
2 changed files with 5 additions and 7 deletions
|
@ -11,16 +11,13 @@ window.addEventListener('load', function() {
|
||||||
var session = Session({messaging: messaging, save: save});
|
var session = Session({messaging: messaging, save: save});
|
||||||
var room = Room({dom: dom, session: session, fun: fun});
|
var room = Room({dom: dom, session: session, fun: fun});
|
||||||
var statusHandler = StatusHandler();
|
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 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 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 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 = {
|
var domElems = {
|
||||||
join: document.getElementById('login').join,
|
|
||||||
invite: document.getElementById('room').invite,
|
invite: document.getElementById('room').invite,
|
||||||
//leave: document.getElementById('login').leave,
|
|
||||||
pickName: document.getElementById('join').getElementsByTagName('label')[0],
|
|
||||||
startGameWith: document.getElementById('invite').getElementsByTagName('label')[0]
|
startGameWith: document.getElementById('invite').getElementsByTagName('label')[0]
|
||||||
};
|
};
|
||||||
for(var key in domElems) {
|
for(var key in domElems) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ Screen.Login = function(modules) {
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
initDOMEvents();
|
initDOM();
|
||||||
initMessageHandlers();
|
initMessageHandlers();
|
||||||
var name = modules.save.get('player.name');
|
var name = modules.save.get('player.name');
|
||||||
if(name != undefined && name.length > 0) {
|
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) {
|
form.addEventListener('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
modules.session.start(form.you.value);
|
modules.session.start(form.you.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
form.you.addEventListener("input", validate);
|
form.you.addEventListener("input", validate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue