<commit_before>(function () {
    // good old store...
    var store = [];

    // execution ground
    init_table( full_data.filter( function ( e ) {
        return e['level'] === 'a';
    }));

    make_zebra();

    $('#clone').click( function ( event ) {
        var start = new Date().getTime();
        var store_copy = store.slice();

        store = [];

        $('tbody').html('');

        make_table( store_copy );
        make_zebra();
        console.log( new Date().getTime() - start );
    });


    // functions definitions
    function with_subtree( id, fun, args ) {
        $('tr.'+id).each( function () {
            with_subtree( $(this).attr('id'), fun );
            fun.apply( $(this), [ args ] );
        });
    }


    function next_letter( letter ) {
        var number = letter.charCodeAt( 0 );

        return String.fromCharCode( number + 1 );
    }
    
    
    function make_table( list ) {
        var level = 'a';
        var nodes_list = Tools.hash_list( list, function ( elem ) {
                              return elem['data'];
                         });

        while( !!nodes_list[ level ] ) {  

            if (level === 'a' ) {
                init_table( nodes_list[ level ] );
            }
            else {
                add_rows( nodes_list[ level ] );
            }

            level = next_letter( level );
        }
    }


    function make_zebra() {
        $('tr').each( function ( i ) {
            if( i % 2 === 0 ) {
                $(this).removeClass( 'odd' );
                $(this).addClass( 'even' );
            }
            else {
                $(this).removeClass( 'even' );
                $(this).addClass( 'odd' );
            }
        });
    }
    
    
    function init_table( list ) {
        var i = 0;
        var store_list = [];

        for( ; i < list.length; ++i ) {
            $('tbody').append( generate_row( list[i] ));
            store_list.push( generate_store_data( list[i] ) );
        }
        make_zebra();

        // append new data into store
        store = [].concat( store, store_list );
    }
    
    
    function add_rows( list ) {
        var i = list.length - 1;
        var store_list = [];

        for( ; i >= 0; i -= 1 ) {
            $('#'+list[i]['parent']).after( generate_row( list[i] ));
            store_list.push( generate_store_data( list[i] ) );
        }

        // append new data into store
        store = [].concat( store, store_list );
    }
    
    
    function generate_store_data( node ) {
        var store_node = {};
        var state = {};
        
        store_node['data'] = node;
        
        state['open'] = false;
        state['marked'] = false;
        state['checked'] = false;
        
        store_node['state'] = state;
        
        return store_node;
    };
    

    function generate_row( node ) {
        var html = [];
        var row;

        // row definition
        html.push( '<tr id="', node['idef'], '" ' );
        html.push( 'data-open="false" ' );
        if( node['level'] === 'a' ) {
            html.push( 'data-selected="false" ' );
        }
        html.push( 'class="', node['level'], ' ', node['parent'],'">' );

        // cells definition
        html.push( '<td class="type', node['leaf'] ? '">' : ' click">' );
        html.push( node['type'], '</td>' );
        html.push( '<td class="name">', node['name'], '</td>' );
        html.push( '<td class="value">', Tools.money(node['v_eu']), '</td>' );
        html.push( '<td class="value">', Tools.money(node['v_nation']), '</td>' );
        html.push( '<td class="value">', Tools.money(node['v_total']), '</td>' );

        html.push( '</tr>' );

        // create & arm row
        row = $( html.join('') );
        row.click( function ( event ) {
            // a-level parent
            var a_root = a_parent( $(this) );<commit_msg>Zebra bug fixed and minor code changes<commit_after>(function () {
    // good old store...
    var store = [];

    // execution ground
    init_table( full_data.filter( function ( e ) {
        return e['level'] === 'a';
    }));

    make_zebra();

    $('#clone').click( function ( event ) {
        var start = new Date().getTime();
        var store_copy = store.slice();

        store = [];

        $('tbody').html('');

        make_table( store_copy );
        make_zebra();
        console.log( new Date().getTime() - start );
    });


    // functions definitions
    function with_subtree( id, fun, args ) {
        $('tr.'+id).each( function () {
            with_subtree( $(this).attr('id'), fun );
            fun.apply( $(this), [ args ] );
        });
    }


    function next_letter( letter ) {
        var number = letter.charCodeAt( 0 );

        return String.fromCharCode( number + 1 );
    }
    
    
    function make_table( list ) {
        var level = 'a';
        var nodes_list = Tools.hash_list( list, function ( elem ) {
                              return elem['data'];
                         });

        while( !!nodes_list[ level ] ) {  

            if (level === 'a' ) {
                init_table( nodes_list[ level ] );
            }
            else {
                add_rows( nodes_list[ level ] );
            }

            level = next_letter( level );
        }
    }


    function make_zebra() {
        $('tr').not(':hidden').each( function ( i ) {
            if( i % 2 === 0 ) {
                $(this).removeClass( 'odd' );
                $(this).addClass( 'even' );
            }
            else {
                $(this).removeClass( 'even' );
                $(this).addClass( 'odd' );
            }
        });
    }
    
    
    function init_table( list ) {
        var i, len = list.length;
        var store_list = [];

        for( i = 0; i < len; ++i ) {
            $('tbody').append( generate_row( list[i] ));
            store_list.push( generate_store_data( list[i] ) );
        }
        make_zebra();

        // append new data into store
        store = [].concat( store, store_list );
    }
    
    
    function add_rows( list ) {
        var i = list.length - 1;
        var store_list = [];

        for( ; i >= 0; i -= 1 ) {
            $('#'+list[i]['parent']).after( generate_row( list[i] ));
            store_list.push( generate_store_data( list[i] ) );
        }

        // append new data into store
        store = [].concat( store, store_list );
    }
    
    
    function generate_store_data( node ) {
        return { 
            data: node,
            state: {
                open: false,
                marked: false,
                checked: false
            }
        };
    };
        

    function generate_row( node ) {
        var html = [];
        var row;

        // row definition
        html.push( '<tr id="', node['idef'], '" ' );
        html.push( 'data-open="false" ' );
        if( node['level'] === 'a' ) {
            html.push( 'data-selected="false" ' );
        }
        html.push( 'class="', node['level'], ' ', node['parent'],'">' );

        // cells definition
        html.push( '<td class="type', node['leaf'] ? '">' : ' click">' );
        html.push( node['type'], '</td>' );
        html.push( '<td class="name">', node['name'], '</td>' );
        html.push( '<td class="value">', Tools.money(node['v_eu']), '</td>' );
        html.push( '<td class="value">', Tools.money(node['v_nation']), '</td>' );
        html.push( '<td class="value">', Tools.money(node['v_total']), '</td>' );

        html.push( '</tr>' );

        // create & arm row
        row = $( html.join('') );
        row.click( function ( event ) {
            // a-level parent
            var a_root = a_parent( $(this) );
{'fraction_non_alphanumeric': 0.1780946208684381, 'fraction_numerical': 0.0020738820479585226, 'mean_word_length': 1.5060084443000974, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 31, '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': '6189841', 'n_tokens_mistral': 2364, 'n_tokens_neox': 2271, 'n_words': 513}