<commit_before><!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>WebSockets with Go</title>
    <style>
        *,
        *:before,
        *:after {
            box-sizing: border-box;
        }

        #chat-container {
            margin: 0 auto;
            width: 40%;
            height: 500px;
            border: 1px solid grey;
        }

        #write-container {
            width: 100%;
            position: relative;
            bottom: 0;
        }

        .message {
            word-wrap: break-word;
        }
    </style>
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
</head>

<body>
    <div id="chat-container">
        <textarea id="write-container" placeholder="Enter your message here..." autofocus></textarea>
        <div id="message-container"></div>
    </div>
</body>

<script>
    // This has to match whatever handler the websockets are served on
    var websock = new WebSocket("ws://" + window.location.host + "/sock")

    var $msgContainer = $("#message-container")
    var $writeContainer = $("#write-container")

    //If enter is pressed, send msg
    $writeContainer.on("keyup", function(e) {
        if (e.keyCode == 13) {
            var msg = $writeContainer.val()
            if (msg.length > 0) {
                $writeContainer.val("")
                websock.send(msg)
            }
        }
    })

    $writeContainer.on("click", function(e) {
        var msg = $writeContainer.val()
        $writeContainer.val("")
        websock.send(msg)
    })

    websock.onmessage = function(payload) {
        $msgContainer.append('<p class="message">' + payload.data + '</p>')
    }
</script>

</html><commit_msg>Added scrolling to the chatbox<commit_after><!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>WebSockets with Go</title>
    <style>
        *,
        *:before,
        *:after {
            box-sizing: border-box;
        }

        #chat-container {
            margin: 0 auto;
            width: 40%;
            border: 1px solid grey;
        }

        #write-container {
            width: 100%;
            position: relative;
            bottom: 0;
        }

        #message-container {
            overflow-y: auto;
            height: 500px;
        }

        .message {
            word-wrap: break-word;
        }
    </style>
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
</head>

<body>
    <div id="chat-container">
        <textarea id="write-container" placeholder="Enter your message here..." autofocus></textarea>
        <div id="message-container"></div>
    </div>
</body>

<script>
    // This has to match whatever handler the websockets are served on
    var websock = new WebSocket("ws://" + window.location.host + "/sock")

    var $msgContainer = $("#message-container")
    var $writeContainer = $("#write-container")

    //If enter is pressed, send msg
    $writeContainer.on("keyup", function(e) {
        if (e.keyCode == 13) {
            var msg = $writeContainer.val()
            if (msg.length > 0) {
                $writeContainer.val("")
                websock.send(msg)
            }
        }
    })

    $writeContainer.on("click", function(e) {
        var msg = $writeContainer.val()
        $writeContainer.val("")
        websock.send(msg)
    })

    websock.onmessage = function(payload) {
        $msgContainer.append('<p class="message">' + payload.data + '</p>')
        //Scroll to the bottom when new messages are appended
        $msgContainer.scrollTop($msgContainer[0].scrollHeight)
    }
</script>

</html>
{'fraction_non_alphanumeric': 0.15068119891008175, 'fraction_numerical': 0.010626702997275205, 'mean_word_length': 1.8391337973704562, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 53, 'https://': 0, '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': '4455140', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1085, 'n_words': 240}