<commit_before>/**
 * Created by Michael on 13/04/2016.
 */

var svgContainers = {};
var averages = {};


$(".country-list").click(function () {
    var countrycode = $(this).attr("id");
    $("#" + selectedCountryCode).toggleClass("selected-country");
    $("#" + countrycode).toggleClass("selected-country");
    selectedCountryCode = countrycode;
    removeEverything();
    years.forEach(function (d) {
        drawCluster(d, 0);
    });
});


function addGraphPlaceholders(years) {
    const noOfColumns = 4;
    const columnWidth = 12 / noOfColumns;
    var container = document.getElementById('container');
    for (var i = 0; i < years.length; i++) {
        var year = years[i];
        /*if (i % noOfColumns === 0) {
         var newRow = document.createElement('div');
         newRow.className = 'row-fluid';
         container.appendChild(newRow);
         }*/
        container.innerHTML += '<div class="col-md-' + columnWidth + ' example" id="graph-' + year + '"></div>';
        document.getElementById('graph-' + year).innerHTML += '<div class="yeartext">' +
            year +
            ' Score: <span id="scoreText-' + year + '"></span>' +
            '<button type="button" class="smallButton" id="giveButton-' + year + '">given</button>' +
            '<button type="button" class="smallButton" id="receiveButton-' + year + '">received</button>' +
            '<button type="button" class="smallButton" id="bothButton-' + year + '">both</button>' +
            '</div>';
        document.getElementById('graph-' + year).innerHTML += '<div class="chart" id="draw-' + year + '"></div>';
        /*if (i % noOfColumns == 0 || i == 0) {
         document.getElementById('container').innerHTML += '</div>'
         }*/
    }
    container.innerHTML += '<img style="width: 300px; height: 300px;" src="http://emojipedia-us.s3.amazonaws.com/cache/bc/6f/bc6f71bfca5a45797cea82ac6f6b9864.png" alt="Crying Face">'
}

var years = [];
for (yearCounter = 1957; yearCounter < 2016; yearCounter++) {
    years.push(yearCounter);
}

var selectedCountryIndex = 0;
var selectedCountryCode = "BE";

addGraphPlaceholders(years);

years.forEach(function (d) {
    drawCluster(d, 0);
});

function removeEverything() {
    years.forEach(function (year) {
        d3.selectAll("#receiveMid-" + year).remove();
        d3.selectAll("#receive-" + year).remove();
        d3.selectAll("#giveMid-" + year).remove();
        d3.selectAll("#give-" + year).remove();

    });
    d3.selectAll(".node").remove();
    d3.selectAll("#no-data-text").remove();
}


document.getElementById("allReceived").addEventListener("click", selectAllReceived);<commit_msg>Added animations<commit_after>/**
 * Created by Michael on 13/04/2016.
 */

var svgContainers = {};
var averages = {};


$(".country-list").click(function () {
    var countrycode = $(this).attr("id");
    $("#" + selectedCountryCode).toggleClass("selected-country");
    $("#" + countrycode).toggleClass("selected-country");
    selectedCountryCode = countrycode;
    removeEverything();
    years.forEach(function (d) {
        drawCluster(d, 0);
    });
});


function addGraphPlaceholders(years) {
    const noOfColumns = 4;
    const columnWidth = 12 / noOfColumns;
    var container = document.getElementById('container');
    for (var i = 0; i < years.length; i++) {
        var year = years[i];
        /*if (i % noOfColumns === 0) {
         var newRow = document.createElement('div');
         newRow.className = 'row-fluid';
         container.appendChild(newRow);
         }*/
        container.innerHTML += '<div class="col-md-' + columnWidth + ' example" id="graph-' + year + '"></div>';
        document.getElementById('graph-' + year).innerHTML += '<div class="yeartext">' +
            year +
            ' Score: <span id="scoreText-' + year + '"></span>' +
            '<button type="button" class="smallButton" id="giveButton-' + year + '">given</button>' +
            '<button type="button" class="smallButton" id="receiveButton-' + year + '">received</button>' +
            '<button type="button" class="smallButton" id="bothButton-' + year + '">both</button>' +
            '</div>';
        document.getElementById('graph-' + year).innerHTML += '<div class="chart" id="draw-' + year + '"></div>';
        /*if (i % noOfColumns == 0 || i == 0) {
         document.getElementById('container').innerHTML += '</div>'
         }*/
    }
    container.innerHTML += '<img style="width: 300px; height: 300px;" src="http://emojipedia-us.s3.amazonaws.com/cache/bc/6f/bc6f71bfca5a45797cea82ac6f6b9864.png" alt="Crying Face">'
    container.innerHTML += '<img style="width: 300px; height: 300px;" src="http://i.imgur.com/IbcZ287.gif" alt="Crying Face">'
    container.innerHTML += '<img style="width: 300px; height: 300px;" src="http://i.imgur.com/oIsKpXd.gif" alt="Crying Face">'
    container.innerHTML += '<img style="width: 300px; height: 300px;" src="http://i.imgur.com/vNkZPcv.gif" alt="Crying Face">'
    container.innerHTML += '<img style="width: 300px; height: 300px;" src="http://i.imgur.com/31EeQ.gif" alt="Crying Face">'
}

var years = [];
for (yearCounter = 1957; yearCounter < 2016; yearCounter++) {
    years.push(yearCounter);
}

var selectedCountryIndex = 0;
var selectedCountryCode = "BE";

addGraphPlaceholders(years);

years.forEach(function (d) {
    drawCluster(d, 0);
});

function removeEverything() {
    years.forEach(function (year) {
        d3.selectAll("#receiveMid-" + year).remove();
        d3.selectAll("#receive-" + year).remove();
        d3.selectAll("#giveMid-" + year).remove();
        d3.selectAll("#give-" + year).remove();

    });
    d3.selectAll(".node").remove();
    d3.selectAll("#no-data-text").remove();
}


document.getElementById("allReceived").addEventListener("click", selectAllReceived);
{'fraction_non_alphanumeric': 0.19362618432385875, 'fraction_numerical': 0.02463393626184324, 'mean_word_length': 3.3199404761904763, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 39, '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': '7264837', 'n_tokens_mistral': 1908, 'n_tokens_neox': 1755, 'n_words': 340}