<commit_before>var token = sessionStorage.getItem('token');
var myName = sessionStorage.getItem('username');

$( document ).ready(function() {
    if (token) {
        displayChatWindow();
        loadMessages();
    } else {
        removeChatWindow();
    }
});

function displayChatWindow() {
    $.get('chat', function(data){
        $("body").append(data);
    });

    $('#chatwindow .toggle').click(function() {
        // not working
        $(this).animate({
            left: '-50%'
        }, 500, function() {
            $(this).css('left', '150%');
            $(this).appendTo('#container');
        });
    });
}

function loadMessages() {
    
}

function removeChatWindow() {
    $('chatwindow').remove();
}<commit_msg>disp;ay chat messages as list #22<commit_after>var token = sessionStorage.getItem('token');
var myName = sessionStorage.getItem('username');

$( document ).ready(function() {
    if (token) {
        displayChatWindow();
        loadMessages();
    } else {
        removeChatWindow();
    }
});

function displayChatWindow() {
    $.get('chat', function(data){
        $("body").append(data);
    });

    $('#chatwindow .toggle').click(function() {
        // not working
        $(this).animate({
            left: '-50%'
        }, 500, function() {
            $(this).css('left', '150%');
            $(this).appendTo('#container');
        });
    });
}

function loadMessages() {
    $.ajax({
        url: 'http://private-1a7f4-kukutodocore.apiary-mock.com/webapi/todos?token='+token,
        type: 'GET',
        success: function(data, status, xhttp) {
            displayChatMessages($('#chat-list ul'), data);
        },
        error: function(data, status, xhttp) {
            console.log("error "+status);
        }
    });
}

function removeChatWindow() {
    $('chatwindow').remove();
}

function displayChatMessages($parent, data) {
    $.each(data, function( i, obj ) {
        var rec = ChatRecord.toRecord(obj);
        console.log(rec.html());
        $parent.append(rec.html());

    });
}

function ChatRecord(data) {
    this.user = data.id;
    this.message = data.text;

    this.html = function() {
        return $('<li/>', {'class':'msg-record'})
            .append( $('<h5/>').append(this.user) )
            .append( $('<h5/>').append(this.message) );
    };

}

ChatRecord.toRecord = function(plain) {
    return new ChatRecord(plain);
}
{'fraction_non_alphanumeric': 0.1934412619344126, 'fraction_numerical': 0.009547530095475302, 'mean_word_length': 2.4232954545454546, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '7428771', 'n_tokens_mistral': 742, 'n_tokens_neox': 726, 'n_words': 127}