game-client.js
function gameOrLobby(games) {
    $(LOBBY).hide();
    $(GAMEROOM).hide();
    $(ADDGUEST).hide();

    if (!$.cookie("player")) {
        drawAddGuest();
        return;
    }

    // hide the fork me banner from now on
    $(FORKME).hide();

    var my_game = $.cookie("game");
    // User is not in a valid game
    if (typeof games[my_game] === 'undefined') {
        $.removeCookie('game');
        $(LOBBY).show();
        drawLobby(games);
    } else {
        $(GAMEROOM).show();
        drawGame();
    }
    $(CHATPNL).show();
    drawChatLog();
    drawChatIn();

    // setup future calls to get chat
    function pollChat() {
        drawChatLog();
        DRAWCHATTID = setTimeout(pollChat, 2000);
    }
    DRAWCHATTID = setTimeout(pollChat, 2000);
}
function gameOrLobby(games) {
    $(LOBBY).hide();
    $(GAMEROOM).hide();
    $(ADDGUEST).hide();

    if (!$.cookie("player")) {
        drawAddGuest();
        return;
    }

    // hide the fork me banner from now on
    $(FORKME).hide();

    var my_game = $.cookie("game");
    // User is not in a valid game
    if (typeof games[my_game] === 'undefined') {
        $.removeCookie('game');
        $(LOBBY).show();
        drawLobby(games);
    } else {
        $(GAMEROOM).show();
        drawGame();
    }
    $(CHATPNL).show();
    drawChatLog();
    drawChatIn();

    // setup future calls to get chat
    function pollChat() {
        drawChatLog();
        DRAWCHATTID = setTimeout(pollChat, 2000);
    }
    DRAWCHATTID = setTimeout(pollChat, 2000);
}
function gameOrLobby ( games ) { $ ( LOBBY ) . hide ( ) ; $ ( GAMEROOM ) . hide ( ) ; $ ( ADDGUEST ) . hide ( ) ; if ( ! $ . cookie ( "player" ) ) { drawAddGuest ( ) ; return ; } // hide the fork me banner from now on $ ( FORKME ) . hide ( ) ; var my_game = $ . cookie ( "game" ) ; // User is not in a valid game if ( typeof games [ my_game ] === 'undefined' ) { $ . removeCookie ( 'game' ) ; $ ( LOBBY ) . show ( ) ; drawLobby ( games ) ; } else { $ ( GAMEROOM ) . show ( ) ; drawGame ( ) ; } $ ( CHATPNL ) . show ( ) ; drawChatLog ( ) ; drawChatIn ( ) ; // setup future calls to get chat function pollChat ( ) { drawChatLog ( ) ; DRAWCHATTID = setTimeout ( pollChat , 2000 ) ; } DRAWCHATTID = setTimeout ( pollChat , 2000 ) ; }
Display the lobby, a game room, or the add guest for the user.
Display the lobby a game room or the add guest for the user .