<commit_before>window.onload = function () {
    (function () {
        var niceRound = function (val, decimals) {
                return Math.round(val * Math.pow(10, decimals)) /  Math.pow(10, decimals);
            },
            populateTable = function (name, marketTotal) {
                var $stockTable = $('caption h2').filter(function() {
                    return ($(this).text().toLowerCase() === name.toLowerCase());
                }).eq(0).closest('table');

                $('<th><a href="javascript:void(0);" class="noWrap">Andel %</a></th>').insertAfter($stockTable.find('th').eq(2)).css('width', 30);

                $stockTable.find('tr.clientSortedRow')
                .each(function () {
                    var $row = $(this),
                        marketValue = parseInt($row.find('> td').eq(8).text().replace(/\s/g, ''), 10);
                    $('<td>' + niceRound(marketValue / marketTotal * 100, 2) + '</td>').insertAfter($row.find('td').eq(2));

                });
            };

        var marketTotalValue = parseInt($('.tableSummary').find('.value').text().replace(/\s/g, ''), 10);

        populateTable('aktier', marketTotalValue);
        populateTable('fonder', marketTotalValue);
    })();
};
<commit_msg>Added share total for each table<commit_after>window.onload = function () {
    (function () {
        var niceRound = function (val, decimals) {
                return Math.round(val * Math.pow(10, decimals)) /  Math.pow(10, decimals);
            },
            populateTable = function (name, marketTotal) {
                var $stockTable = $('caption h2').filter(function() {
                    return ($(this).text().toLowerCase() === name.toLowerCase());
                }).eq(0).closest('table');

                $('<th><a href="javascript:void(0);" class="noWrap">Andel %</a></th>').insertAfter($stockTable.find('th').eq(2)).css('width', 30);
                $('<td>' + $.trim($stockTable.find('caption .allocation').text().split(':')[1]) + '</td>').insertAfter($stockTable.find('tfoot td').eq(0));

                $stockTable.find('tr.clientSortedRow')
                .each(function () {
                    var $row = $(this),
                        marketValue = parseInt($row.find('> td').eq(8).text().replace(/\s/g, ''), 10);
                    $('<td>' + niceRound(marketValue / marketTotal * 100, 2) + '</td>').insertAfter($row.find('td').eq(2));

                });
            };

        var marketTotalValue = parseInt($('.tableSummary').find('.value').text().replace(/\s/g, ''), 10);

        populateTable('aktier', marketTotalValue);
        populateTable('fonder', marketTotalValue);
    })();
};
{'fraction_non_alphanumeric': 0.20783582089552238, 'fraction_numerical': 0.015671641791044775, 'mean_word_length': 2.187871581450654, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '7506568', 'n_tokens_mistral': 814, 'n_tokens_neox': 758, 'n_words': 118}