<commit_before>var access_token = "";
var img_url = "";
var first_name = "";
var id = "";

function saveToken(accessToken) {
  access_token = accessToken;
}

// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {

  // Logged into your app and Facebook.
  if (response.status === 'connected') {
    saveToken(response.authResponse.accessToken);
    getProfileInfo();
    updateView();
  } else if (response.status === 'not_authorized') {
    /* TODO */
  } else {
    FB.login(function(response) {
      if (response.authResponse ) {
        saveToken(response.authResponse.accessToken);
        getProfileInfo();
        updateView();
      }
    }, {scope: 'user_about_me,user_location'});
  }
}

// This function is called when someone finishes with the Login
// Button.  See the onlogin handler attached to it in the sample
// code below.
function checkLoginState() {
  FB.getLoginStatus(function(response) {
    statusChangeCallback(response);
  }, {scope: 'user_about_me,user_location'});
}

function getProfileInfo() {
  FB.api('/me?field=id,first_name,location', function(response) {
    first_name = response.first_name;
    id = response.id;
    $('#title').text("Hi " + first_name + ". Insert your health profile!");
  });

  FB.api("/me/picture?type=normal&height=120&width=120&redirect=false", function(response) {
    img_url = response.data.url;
    $('#fb-image').css('background-image', 'url(' + response.data.url + ')');
  });
}

function send_request(obj) {

  var weight_obj = {"measureValue": obj.weight, "measureType":"weight"};
  var height_obj = {"measureValue": obj.height, "measureType":"weight"};
  var url_w = "https://192.168.127.12:8086/dbservice/person/" + id + "/weight";
  var url_h = "https://192.168.127.12:8086/dbservice/person/" + id + "/height";

  $.ajax({
      type: "POST",
      url: url_w,
      data: JSON.stringify(weight_obj),
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(data) {
        console.log(data);
      },
      failure: function(errMsg) {
        console.log(errMsg);
      }
  });

  // $.ajax({
  //     type: "POST",
  //     url: url_h,<commit_msg>social.js updated<commit_after>var access_token = "";
var img_url = "";
var first_name = "";
var id = "";

function saveToken(accessToken) {
  access_token = accessToken;
}

// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {

  // Logged into your app and Facebook.
  if (response.status === 'connected') {
    saveToken(response.authResponse.accessToken);
    getProfileInfo();
    updateView();
  } else if (response.status === 'not_authorized') {
    /* TODO */
  } else {
    FB.login(function(response) {
      if (response.authResponse ) {
        saveToken(response.authResponse.accessToken);
        getProfileInfo();
        updateView();
      }
    }, {scope: 'user_about_me,user_location'});
  }
}

// This function is called when someone finishes with the Login
// Button.  See the onlogin handler attached to it in the sample
// code below.
function checkLoginState() {
  FB.getLoginStatus(function(response) {
    statusChangeCallback(response);
  }, {scope: 'user_about_me,user_location'});
}

function getProfileInfo() {
  FB.api('/me?field=id,first_name,location', function(response) {
    first_name = response.first_name;
    id = response.id;
    $('#title').text("Hi " + first_name + ". Insert your health profile!");
  });

  FB.api("/me/picture?type=normal&height=120&width=120&redirect=false", function(response) {
    img_url = response.data.url;
    $('#fb-image').css('background-image', 'url(' + response.data.url + ')');
  });
}

function send_request(obj) {

  var weight_obj = {"measureValue": obj.weight, "measureType":"weight"};
  var height_obj = {"measureValue": obj.height, "measureType":"weight"};
  var url_w = "http://192.168.127.12:8086/dbservice/person/" + id + "/weight";
  var url_h = "http://192.168.127.12:8086/dbservice/person/" + id + "/height";

  $.ajax({
      type: "POST",
      url: url_w,
      data: JSON.stringify(weight_obj),
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function(data) {
        console.log(data);
      },
      failure: function(errMsg) {
        console.log(errMsg);
      }
  });

  // $.ajax({
  //     type: "POST",
  //     url: url_h,
{'fraction_non_alphanumeric': 0.16411526339486718, 'fraction_numerical': 0.016659162539396668, 'mean_word_length': 3.4033696729435086, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '288171', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1397, 'n_words': 288}