game-client.js
function drawAddGuest() {
    $(ADDGUEST).show();

    function submit() {
        var name =  $(ADDGUESTFRM+"> input")[0].value;
        if (!NAMERE.test(name)) {
            if(name) {
                alert("Your input text is too long!");
            }
            return false;
        }
        $.cookie("player", name);
        main();
    }
    $(ADDGUESTFRM+"> button").click(submit);
    $(ADDGUESTFRM+"> input:visible").focus();
    $(ADDGUESTFRM+"> input").keydown(function(event) {
        if (event.keyCode === 13) {
            submit();
        }
    });
}
function drawAddGuest() {
    $(ADDGUEST).show();

    function submit() {
        var name =  $(ADDGUESTFRM+"> input")[0].value;
        if (!NAMERE.test(name)) {
            if(name) {
                alert("Your input text is too long!");
            }
            return false;
        }
        $.cookie("player", name);
        main();
    }
    $(ADDGUESTFRM+"> button").click(submit);
    $(ADDGUESTFRM+"> input:visible").focus();
    $(ADDGUESTFRM+"> input").keydown(function(event) {
        if (event.keyCode === 13) {
            submit();
        }
    });
}
function drawAddGuest ( ) { $ ( ADDGUEST ) . show ( ) ; function submit ( ) { var name = $ ( ADDGUESTFRM + "> input" ) [ 0 ] . value ; if ( ! NAMERE . test ( name ) ) { if ( name ) { alert ( "Your input text is too long!" ) ; } return false ; } $ . cookie ( "player" , name ) ; main ( ) ; } $ ( ADDGUESTFRM + "> button" ) . click ( submit ) ; $ ( ADDGUESTFRM + "> input:visible" ) . focus ( ) ; $ ( ADDGUESTFRM + "> input" ) . keydown ( function ( event ) { if ( event . keyCode === 13 ) { submit ( ) ; } } ) ; }
Draw the add guest widget.
- Set the player cookie when the user submits and switch to displaying the
chat input.
Draw the add guest widget . - Set the player cookie when the user submits and switch to displaying the chat input .