<commit_before>var Sidebar = function(markers) {
    this.scrollCounter = 0;
    this.sidebar = null;

    this.markers = markers;
};

Sidebar.prototype.initialize = function(map) {
    this.sidebar = L.control.sidebar('sidebar', {position: 'right'}).addTo(map);
};

Sidebar.prototype.open = function() {
    this.sidebar.open('hopsPane');
};

Sidebar.prototype.tableTemplate = function(data) {
    return '<tr><td>' + template.hopTemplate(data) + '</td></tr>';
};

Sidebar.prototype.appendTable = function(data) {
    $('#hopsTable').append(this.tableTemplate(data));
    $('.sidebar-content').animate({scrollTop: this.scrollCounter += 500}, 1000);

    var markers = this.markers;

    var hopsTableRow = $('#hopsTable tr');
    hopsTableRow.unbind('click');
    hopsTableRow.click(function() {
        markers[$(this).index()].openPopup();
    });
};

Sidebar.prototype.clearTable = function() {
    this.scrollCounter = 0;
    $('#hopsTable').empty();
};<commit_msg>Rework table-popup binding<commit_after>var Sidebar = function(markers) {
    this.scrollCounter = 0;
    this.sidebar = null;

    this.markers = markers;
};

Sidebar.prototype.initialize = function(map) {
    this.sidebar = L.control.sidebar('sidebar', {position: 'right'}).addTo(map);
};

Sidebar.prototype.open = function() {
    this.sidebar.open('hopsPane');
};

Sidebar.prototype.tableTemplate = function(data) {
    return '<tr><td>' + template.hopTemplate(data) + '</td></tr>';
};

Sidebar.prototype.appendTable = function(data) {
    $('#hopsTable').append(this.tableTemplate(data));
    $('.sidebar-content').animate({scrollTop: this.scrollCounter += 500}, 1000);

    var markers = this.markers;

    var hopsTableRow = $('#hopsTable tr');
    hopsTableRow.unbind('click');
    hopsTableRow.click(function() {
        var html = $(this).html();
        var index = markers.findIndex(function(value) {
            return html.includes(value._popup._content);
        });
        markers[index].openPopup();
    });
};

Sidebar.prototype.clearTable = function() {
    this.scrollCounter = 0;
    $('#hopsTable').empty();
};
{'fraction_non_alphanumeric': 0.183547313361864, 'fraction_numerical': 0.008559201141226819, 'mean_word_length': 3.9158878504672896, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3076757', 'n_tokens_mistral': 687, 'n_tokens_neox': 646, 'n_words': 102}