<commit_before>/**
 * Print the current url
 */
chrome.tabs.query({ active: true, lastFocusedWindow: true}, 
    function(array_of_Tabs) { // Since there can only be one active tab in one active window, 
                              //  the array has only one element
      var tab = array_of_Tabs[0];
      var url = tab.url;
      console.log("new Current " + url);

  });


/**
 *  add event listener to a group of buttuns
 */
var cpfValue = 3;
function setCpfValue(newCpf)
{
  cpfValue = newCpf;
}

function httpGet(cpf)
{

    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", "https://ess-20171-presence-server.herokuapp.com/lesson/listByCpf?cpf="+cpf, false ); // false for synchronous request
    xmlHttp.send( null );
    console.log( xmlHttp.responseText);
    return xmlHttp.responseText;
}
document.addEventListener('DOMContentLoaded', function () {
  //console.log(document.querySelector('button'));
  //document.querySelector('button').addEventListener('click', httpGet(cpfValue));
  document.getElementById('RequestJson').addEventListener('click', httpGet(cpfValue));

});



// https://ess-20171-presence-server.herokuapp.com/lesson/listByCpf?cpf=3<commit_msg>Change the call of httpGet, now it will work with button<commit_after>/**
 * Print the current url
 */
chrome.tabs.query({ active: true, lastFocusedWindow: true}, 
    function(array_of_Tabs) { // Since there can only be one active tab in one active window, 
                              //  the array has only one element
      var tab = array_of_Tabs[0];
      var url = tab.url;
      console.log("new Current " + url);

  });


/**
 *  add event listener to a group of buttuns
 */
var cpfValue = 3;
function setCpfValue(newCpf)
{
  cpfValue = newCpf;
}

function httpGet(cpf)
{

    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", "https://ess-20171-presence-server.herokuapp.com/lesson/listByCpf?cpf="+cpf, false ); // false for synchronous request
    xmlHttp.send( null );
    console.log( xmlHttp.responseText);
    return xmlHttp.responseText;
}
document.addEventListener('DOMContentLoaded', function () {
  //console.log(document.querySelector('button'));
  //document.querySelector('button').addEventListener('click', httpGet(cpfValue));
  var requestButton = document.getElementById('RequestJson');

  requestButton.addEventListener("click", function(){
      httpGet(cpfValue);
  });

});



// https://ess-20171-presence-server.herokuapp.com/lesson/listByCpf?cpf=3
{'fraction_non_alphanumeric': 0.13790322580645162, 'fraction_numerical': 0.010483870967741936, 'mean_word_length': 3.5944444444444446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6448187', 'n_tokens_mistral': 790, 'n_tokens_neox': 764, 'n_words': 175}