<commit_before>$(document).ready(function() {

    $("#learnmore__btn_id").magnificPopup({
        disableOn: 700,
        type: 'iframe',
        mainClass: 'mfp-fade',
        removalDelay: 160,
        preloader: false,
        fixedContentPos: false,
        callbacks: {
            open: function(){
                if(ga){
                    ga('send', 'event', 'button', 'click', 'learnmore_clicked');
                }
            }
        }
    });

    $.ajax({url: metadata_url,success:function(result){
    $("#metadata_timestamp").html('Data last updated: <a href="' + metadata_url + '">' + result.timestamp.split('T')[0] + "</a>");
    }});

    //initialize ghostHunter
    $("#search-field").ghostHunter({
        results: "#search-results"
    });

    //auto search on typing
    var thread = null;
    $('#search-field').keyup(function() {
        clearTimeout(thread);
        var target = $(this);
        thread = setTimeout(function() { target.submit(); }, 500);
    });<commit_msg>added a function to render api stats.<commit_after>// http://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript
function numberWithCommas(num) {
    return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

$(document).ready(function() {

    $("#learnmore__btn_id").magnificPopup({
        disableOn: 700,
        type: 'iframe',
        mainClass: 'mfp-fade',
        removalDelay: 160,
        preloader: false,
        fixedContentPos: false,
        callbacks: {
            open: function(){
                if(ga){
                    ga('send', 'event', 'button', 'click', 'learnmore_clicked');
                }
            }
        }
    });

    // render metadata timestamp
    $.ajax({url: metadata_url,success:function(result){
    $("#metadata_timestamp").html('Data last updated: <a href="' + metadata_url + '">' + result.timestamp.split('T')[0] + "</a>");
    }});

    // render api stats
    $.ajax({url: api_stats_url, success:function(result){
        var sessionsCount = result.totalsForAllResults['ga:sessions'];
        var sessionCountFormatted  = numberWithCommas(sessionsCount);
        $("#api_stats").html('<h3 style="margin:0;">'+sessionCountFormatted+'</h3><p style="margin:0;">requests in last 30 days</p>')
    }});


    //initialize ghostHunter
    $("#search-field").ghostHunter({
        results: "#search-results"
    });

    //auto search on typing
    var thread = null;
    $('#search-field').keyup(function() {
        clearTimeout(thread);
        var target = $(this);
        thread = setTimeout(function() { target.submit(); }, 500);
    });
{'fraction_non_alphanumeric': 0.1800751879699248, 'fraction_numerical': 0.012781954887218045, 'mean_word_length': 2.5151915455746368, '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': '765099', 'n_tokens_mistral': 825, 'n_tokens_neox': 787, 'n_words': 142}