<commit_before>// INITIALIZE SOCKET

var socket = io();

// BIND BROWSER EVENTS TO SOCKET EVENT EMITTERS
function afterReady() {
    var regPopup = new $.Popup();
    console.log(regPopup.options);
    // regPopup.open('views/register.html');

    $('.popup').popup({
        width: 500,
        heigth: 150,
        afterOpen: function() {
            $('#join-room').click(function() {
                var roomName = $('#roomName').val();
                joinRoom(roomName);
            });

            $('#create-room').click(function() {
                var roomName = $('#roomName').val();
                createRoom(roomName);
            });
        }

    });

    $('#send-message').click(function() {
        console.log("clicking send")
        var msg = $('#message').val();
        sendMsg(msg, socket.id);
        receiveMsg(msg);
        $('#message').val('');
    });
}

// SOCKET EVENT LISTENERS

socket.on('register', function() {
    // call popup to register
});

socket.on('message', function(data) {
    receiveMsg(data.msg, data.id);
});

socket.on('room-error', function(errMsg) {
    // reveal alert message
    $('.alert-danger').append(errMsg);
    $('.alert-danger').show();
});

socket.on('success', function(msg, data) {
    $('.popup_close').click();
    $('#messages').append('<li class="admin">' + msg);
    $('.room p').text('Room name: ' + data.name);
});

// SOCKET EVENT EMITTERS

function createRoom(roomName) {
    socket.emit('create-room', roomName);
}

function joinRoom(roomName) {
    socket.emit('join-room', roomName);
}

function sendMsg(msg, id) {
    socket.emit('message', msg, id);
}

// HELPER
function receiveMsg(msg, sender) {
    console.log('from others')
    $('#messages').append("<li>" + sender + ": " + msg);
}

function receiveMsg(msg) {
    console.log('from yourself')
    $('#messages').append("<li>you: " + msg);    
}

// Init 
$(document).ready(afterReady);
<commit_msg>Send button submitting as form value after beautifying<commit_after>// INITIALIZE SOCKET

var socket = io();

// BIND BROWSER EVENTS TO SOCKET EVENT EMITTERS
function afterReady() {
    var regPopup = new $.Popup();
    console.log(regPopup.options);
    // regPopup.open('views/register.html');

    $('.popup').popup({
        width: 500,
        heigth: 150,
        afterOpen: function() {
            $('#join-room').click(function() {
                var roomName = $('#roomName').val();
                joinRoom(roomName);
            });

            $('#create-room').click(function() {
                var roomName = $('#roomName').val();
                createRoom(roomName);
            });
        }

    });

    $('#send-message').click(function(e) {
        console.log("clicking send")
        e.preventDefault();
        var msg = $('#message').val();
        sendMsg(msg, socket.id);
        receiveMsg(msg);
        $('#message').val('');
    });
}

// SOCKET EVENT LISTENERS

socket.on('register', function() {
    // call popup to register
});

socket.on('message', function(data) {
    receiveMsg(data.msg, data.id);
});

socket.on('room-error', function(errMsg) {
    // reveal alert message
    $('.alert-danger').append(errMsg);
    $('.alert-danger').show();
});

socket.on('success', function(msg, data) {
    $('.popup_close').click();
    $('#messages').append('<li class="admin">' + msg);
    $('.room p').text('Room name: ' + data.name);
});

// SOCKET EVENT EMITTERS

function createRoom(roomName) {
    socket.emit('create-room', roomName);
}

function joinRoom(roomName) {
    socket.emit('join-room', roomName);
}

function sendMsg(msg, id) {
    socket.emit('message', msg, id);
}

// HELPER
function receiveMsg(msg, sender) {
    console.log('from others')
    $('#messages').append("<li>" + sender + ": " + msg);
}

function receiveMsg(msg) {
    console.log('from yourself')
    $('#messages').append("<li>you: " + msg);    
}

// Init 
$(document).ready(afterReady);

{'fraction_non_alphanumeric': 0.20070957932083122, 'fraction_numerical': 0.0030410542321338066, 'mean_word_length': 2.6819029850746268, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 9, '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': '1505719', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1237, 'n_words': 234}