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

    var DrawChart = function() {         
    //Create horizontal bar chart using JQuery
    $('.chart').horizBarChart({selector: '.bar',speed: 3000});
    };

    var cleanup = function() {
        $('#searchbox #intro').empty();
        $('#searchbox #intro2').empty();
        $('#askgithub').empty();
        $('#result').empty();
        $('#progress').show();
    }
    
    //Handle submit
    $('#askgithub').submit(function() {
        $('#searchbox #intro').empty();
        $('#result').empty();
        $('#progress').show();
    });
    
    
    //Handle project intro
    if ($('#result').html().trim()) {
        $('#searchbox #intro').hide();
    }
    
    
    //Bind to hyperlinks 
    $('a.repositoryinfo').bind('click', cleanup);
   
   //Handle chart div
    $('.chart').horizBarChart({selector: '.bar',speed: 3000});

   
    //Find similar repositories on demand
    $('a#findsimilarrepos').bind('click', function() {
       ga('send', {
           'hitType': 'event',          // Required.
           'eventCategory': 'similarrepos',   // Required.
           'eventAction': 'click',      // Required.
           'eventLabel': $('input[name="reponame"]').val()
        });
        $("#wrapperfindsimilarrepos").empty();
        $("#wrapperfindsimilarrepos").html("finding similar repositories just for you <i class=\"fa fa-spinner fa-spin fa-1x\"></i>");
        var d2 = $.ajax({
            url : '/_findsimilarrepositories',
            dataType : 'json',
            timeout : (600000),
            data : {
                a : $('input[name="reponame"]').val()
            },
            success : function(data) {
                $("#similarrepos").html(data.similarrepos);
                $("#wrapperfindsimilarrepos").empty();
            },
            error : function(objAJAXRequest, strError) {
                $("#similarrepos").html("<span class=\"text-danger\">Query taking too long: Please try again latter</span>");
                $("#wrapperfindsimilarrepos").empty();
            }
        });
        $.when( d2 ).done(function(){
            $('a.repositoryinfo').bind('click',cleanup);
        });
        return false;
    });

    //Find trending topics on demand
    $('a#findtrendingtopics').bind('click', function() {
    	ga('send', {
           'hitType': 'event',          // Required.
           'eventCategory': 'trendingtopics',   // Required.
           'eventAction': 'click',      // Required.
           'eventLabel': $('input[name="reponame"]').val()
        });
        $("#wrapperfindtrendingtopics").empty();
        $("#wrapperfindtrendingtopics").html("finding interesting topics just for you <i class=\"fa fa-spinner fa-spin fa-1x\"></i>");
        var d2 = $.ajax({
            url : '/_findtrendingtopics',
            dataType : 'json',
            timeout : (60000),
            data : {
                qvalue : $('input[name="qvalue"]').val(),qtype : $('input[name="qtype"]').val()
            },<commit_msg>update GA code; not using eventLabel<commit_after>$(document).ready(function() {

    var DrawChart = function() {         
    //Create horizontal bar chart using JQuery
    $('.chart').horizBarChart({selector: '.bar',speed: 3000});
    };

    var cleanup = function() {
        $('#searchbox #intro').empty();
        $('#searchbox #intro2').empty();
        $('#askgithub').empty();
        $('#result').empty();
        $('#progress').show();
    }
    
    //Handle submit
    $('#askgithub').submit(function() {
        $('#searchbox #intro').empty();
        $('#result').empty();
        $('#progress').show();
    });
    
    
    //Handle project intro
    if ($('#result').html().trim()) {
        $('#searchbox #intro').hide();
    }
    
    
    //Bind to hyperlinks 
    $('a.repositoryinfo').bind('click', cleanup);
   
   //Handle chart div
    $('.chart').horizBarChart({selector: '.bar',speed: 3000});

   
    //Find similar repositories on demand
    $('a#findsimilarrepos').bind('click', function() {
       ga('send', {
           'hitType': 'event',          // Required.
           'eventCategory': 'similarrepos',   // Required.
           'eventAction': $('input[name="reponame"]').val()      // Required.
        });
        $("#wrapperfindsimilarrepos").empty();
        $("#wrapperfindsimilarrepos").html("finding similar repositories just for you <i class=\"fa fa-spinner fa-spin fa-1x\"></i>");
        var d2 = $.ajax({
            url : '/_findsimilarrepositories',
            dataType : 'json',
            timeout : (600000),
            data : {
                a : $('input[name="reponame"]').val()
            },
            success : function(data) {
                $("#similarrepos").html(data.similarrepos);
                $("#wrapperfindsimilarrepos").empty();
            },
            error : function(objAJAXRequest, strError) {
                $("#similarrepos").html("<span class=\"text-danger\">Query taking too long: Please try again latter</span>");
                $("#wrapperfindsimilarrepos").empty();
            }
        });
        $.when( d2 ).done(function(){
            $('a.repositoryinfo').bind('click',cleanup);
        });
        return false;
    });

    //Find trending topics on demand
    $('a#findtrendingtopics').bind('click', function() {
    	ga('send', {
           'hitType': 'event',          // Required.
           'eventCategory': 'trendingtopics',   // Required.
           'eventAction': $('input[name="reponame"]').val()      // Required.
        });
        $("#wrapperfindtrendingtopics").empty();
        $("#wrapperfindtrendingtopics").html("finding interesting topics just for you <i class=\"fa fa-spinner fa-spin fa-1x\"></i>");
        var d2 = $.ajax({
            url : '/_findtrendingtopics',
            dataType : 'json',
            timeout : (60000),
            data : {
                qvalue : $('input[name="qvalue"]').val(),qtype : $('input[name="qtype"]').val()
            },
{'fraction_non_alphanumeric': 0.19587971423824554, 'fraction_numerical': 0.00830702774547267, 'mean_word_length': 2.0251256281407035, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '5589077', 'n_tokens_mistral': 1738, 'n_tokens_neox': 1649, 'n_words': 317}