<commit_before><!DOCTYPE html>
<html>
    <head>
        <title>Start Page</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />

        <!-- Bootstrap core CSS -->
        <link href="bootstrap.min.css" rel="stylesheet">

        <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
        <link href="ie10-viewport-bug-workaround.css" rel="stylesheet">

        <!-- Custom styles for this template -->
        <link href="starter-template.css" rel="stylesheet">

        <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
        <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
        <script src="ie-emulation-modes-warning.js"></script>

        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->        


    </head>
    <body>
        <script>

            var socket = new WebSocket("ws://localhost:8080/mafia-game-server/ws");
            var clientID;

            socket.onmessage = function (event) {
                var messageFromServer = JSON.parse(event.data);

                //Message is a chat message
                if (messageFromServer.event === "ChatMessage") {
                    document.getElementById("out").value = document.getElementById("out").value + messageFromServer.player + ": " + messageFromServer.message + "\n";

                } else if (messageFromServer.event === "GameState") {
                    //Hide the login bit
                    document.getElementById("createGameDiv").style.display = 'none';


                } else {
                    //We dont know what this is
                    document.getElementById("out").value = document.getElementById("out").value + messageFromServer + "\n";
                }
            };


            function createGame() {
                var msg = {
                    type: "CreateGame",
                    event: "CreateGameEvent",
                    name: document.getElementById("name").value,
                    passCode: document.getElementById("passCode").value
                };

                socket.send(JSON.stringify(msg));

            }

            function sendChat() {
                // Construct a msg object containing the data the server needs to process the message from the chat client.
                var msg = {
                    type: "Chat",
                    event: "ChatEvent",
                    message: document.getElementById("lips").value
                };

                socket.send(JSON.stringify(msg));

            }


            function sendText() {
                // Construct a msg object containing the data the server needs to process the message from the chat client.
                var msg = {
                    type: "message",
                    text: document.getElementById("in").value,
                    id: clientID,
                    date: Date.now()
                };

                // Send the msg object as a JSON-formatted string.
                socket.send(JSON.stringify(msg));

                // Blank the text input element, ready to receive the next line of text from the user.
                document.getElementById("in").value = "";
            }
        </script>


        <nav class="navbar navbar-inverse navbar-fixed-top">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="./">Mafia</a>
                </div>
                <div id="navbar" class="collapse navbar-collapse">
                    <ul class="nav navbar-nav">
                    </ul>
                </div><!--/.nav-collapse -->
            </div>
        </nav>

        <div class="container">


            <div id="createGameDiv">
                <h1>Create a Game!</h1>
                <div class="container">
                    <div class="row">
                        <div class="col-md-3">
                            <div class="form-group">
                                <input class="form-control" name="name" id="name" placeholder="<NAME>" />
                                <input class="form-control" name="passCode" id="passCode" placeholder="Passcode" />
                                <button class="form-control" onclick="createGame();" >Create a game!</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <br />
            <br />
            <br />

            <div class="container">
                <div class="row">
                    <div class="col-md-3">
                        <!--<div class="form-group">-->
                        <textarea name="out" id="out" ></textarea>
                        <input name="lips" id="lips" />
                        <button onclick="sendChat();" >Talk!</button>
                        <!--</div>-->
                    </div>
                </div>
            </div>



        </div><!-- /.container -->
<commit_msg>Joining game<commit_after><!DOCTYPE html>
<html>
    <head>
        <title>Start Page</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />

        <!-- Bootstrap core CSS -->
        <link href="bootstrap.min.css" rel="stylesheet">

        <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
        <link href="ie10-viewport-bug-workaround.css" rel="stylesheet">

        <!-- Custom styles for this template -->
        <link href="starter-template.css" rel="stylesheet">

        <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
        <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
        <script src="ie-emulation-modes-warning.js"></script>

        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->        


    </head>
    <body>
        <script>

            var socket = new WebSocket("ws://localhost:8080/mafia-game-server/ws");
            var clientID;

            socket.onmessage = function (event) {
                var messageFromServer = JSON.parse(event.data);

                //Message is a chat message
                if (messageFromServer.event === "ChatMessage") {
                    document.getElementById("out").value = document.getElementById("out").value + messageFromServer.player + ": " + messageFromServer.message + "\n";

                } else if (messageFromServer.event === "GameState") {
                    //Hide the login bit
                    document.getElementById("createGameDiv").style.display = 'none';
                    document.getElementById("chatDiv").style.display = 'block';

                } else {
                    //We dont know what this is
                    document.getElementById("out").value = document.getElementById("out").value + messageFromServer + "\n";
                }
            };


            function createGame() {
                var msg = {
                    type: "CreateGame",
                    event: "CreateGameEvent",
                    name: document.getElementById("name").value,
                    passCode: document.getElementById("passCode").value
                };

                socket.send(JSON.stringify(msg));

            }

            function sendChat() {
                // Construct a msg object containing the data the server needs to process the message from the chat client.
                var msg = {
                    type: "Chat",
                    event: "ChatEvent",
                    message: document.getElementById("lips").value
                };

                socket.send(JSON.stringify(msg));

            }

            function joinGame() {
                // Construct a msg object containing the data the server needs to process the message from the chat client.
                var msg = {
                    type: "JoinGame",
                    event: "JoinGameEvent",
                    name: document.getElementById("name").value,
                    passCode: document.getElementById("passCode").value,
                    key:  document.getElementById("gameCode").value
                };

                socket.send(JSON.stringify(msg));

            }

            function sendText() {
                // Construct a msg object containing the data the server needs to process the message from the chat client.
                var msg = {
                    type: "message",
                    text: document.getElementById("in").value,
                    id: clientID,
                    date: Date.now()
                };

                // Send the msg object as a JSON-formatted string.
                socket.send(JSON.stringify(msg));

                // Blank the text input element, ready to receive the next line of text from the user.
                document.getElementById("in").value = "";
            }
        </script>


        <nav class="navbar navbar-inverse navbar-fixed-top">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="./">Mafia</a>
                </div>
                <div id="navbar" class="collapse navbar-collapse">
                    <ul class="nav navbar-nav">
                    </ul>
                </div><!--/.nav-collapse -->
            </div>
        </nav>

        <div class="container">


            <div id="createGameDiv">
                <h1>Create a Game!</h1>
                <div class="container">
                    <div class="row">
                        <div class="col-md-3"></div>
                        <div class="col-md-3">
                            <div class="form-group">
                                <input class="form-control" name="name" id="name" placeholder="Your name" />
                                <input class="form-control" name="passCode" id="passCode" placeholder="<PASSWORD>" />
                                <button class="form-control" onclick="createGame();" >Create a game</button>
                                <br />
                                <input class="form-control" name="gameCode" id="gameCode" placeholder="Game Code" />
                                <button class="form-control" onclick="joinGame();" >Join a game</button>
                            </div>
                        </div>
                        <div class="col-md-3"></div>
                    </div>
                    <div class="row">
                        <div class="col-md-3"></div>
                        <div class="col-md-3">
                            <div class="form-group">
                            </div>
                        </div>
                        <div class="col-md-3"></div>
                    </div>
                </div>
            </div>


            <div id="chatDiv">
                <h1>Chat</h1>
                <div class="container">
                    <div class="row">
                        <div class="col-md-3"></div>
                        <div class="col-md-3">
                            <!--<div class="form-group">-->
                            <textarea name="out" id="out" ></textarea>
                            <input name="lips" id="lips" />
                            <button onclick="sendChat();" >Talk!</button>
                            <!--</div>-->
                        </div>
                        <div class="col-md-3"></div>
                    </div>
                </div>
            </div>
            <script>
                document.getElementById("chatDiv").style.display = 'none';
            </script>



        </div><!-- /.container -->

{'fraction_non_alphanumeric': 0.13728687916975538, 'fraction_numerical': 0.005263157894736842, 'mean_word_length': 1.3172449330127105, 'pattern_counts': {'":': 2, '<': 216, '<?xml version=': 0, '>': 216, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2361339', 'n_tokens_mistral': 3476, 'n_tokens_neox': 3168, 'n_words': 746}