<commit_before>// import "jquery.js"

$(document).ready(function(){
  getIP()
  $(document).click(getClicksPerSession)
  // $(window).unload(sendUser)
  $('a').click(addDestination)
  $(window).bind('beforeunload', sendUser)
})

function getIP(){
  $.get("http://ipinfo.io", function(response) {
    user = response;
    user.arrival = new Date
    user.clicks = {}
    user.domain = "test"
    // now = getTime()
  }, "jsonp");
}

function getClicksPerSession(e){
  user.clicks[e.target.innerHTML.split(" ")[0]]= new Date - user.arrival
}

function addDestination(){
  user.destination = $(this).attr("href")
}

function sendUser(e){
  e.preventDefault()
  user.leave = new Date
  $.ajax({
    type: "POST",
    url: "http://localhost:3000/visitors/manage",
    data: user,
  }).done(function(){<commit_msg>update way clicks are managed<commit_after>// import "jquery.js"

$(document).ready(function(){
  getIP()
  $(document).click(getClicksPerSession)
  // $(window).unload(sendUser)
  $('a').click(addDestination)
  $(window).bind('beforeunload', sendUser)
})

function getIP(){
  $.get("http://ipinfo.io", function(response) {
    user = response;
    user.arrival = new Date
    user.clicks = 0
    user.domain = "test"
    // now = getTime()
  }, "jsonp");
}

function getClicksPerSession(e){
  user.clicks += 1

function addDestination(){
  user.destination = $(this).attr("href")
}

function sendUser(e){
  e.preventDefault()
  user.leave = new Date
  $.ajax({
    type: "POST",
    url: "http://localhost:3000/visitors/manage",
    data: user,
  }).done(function(){
{'fraction_non_alphanumeric': 0.19238095238095237, 'fraction_numerical': 0.006984126984126984, 'mean_word_length': 3.8641975308641974, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '453000', 'n_tokens_mistral': 554, 'n_tokens_neox': 547, 'n_words': 101}