<commit_before>'use strict';

// Call this function when the page loads (the "ready" event)
$(document).ready(function() {
	initializePage();
})

/*
 * Function that is called when the document is ready.
 */
function initializePage() {
	$('.project a').click(addProjectDetails);

	$('#colorBtn').click(randomizeColors);
}

/*
 * Make an AJAX call to retrieve project details and add it in
 */
function addProjectDetails(e) {
	// Prevent following the link
	e.preventDefault();

	// Get the div ID, e.g., "project3"
	var projectID = $(this).closest('.project').attr('id');
	// get rid of 'project' from the front of the id 'project3'
	var idNumber = projectID.substr('project'.length);

	console.log("User clicked on project " + idNumber);
}

/*
 * Make an AJAX call to retrieve a color palette for the site
 * and apply it
 */
function randomizeColors(e) {
	console.log("User clicked on color button");
}<commit_msg>mostly done, just need to finish the pallette part at the very end<commit_after>'use strict';

// Call this function when the page loads (the "ready" event)
$(document).ready(function() {
  initializePage();
})



/*
 * Function that is called when the document is ready.
 */
function initializePage() {
  $('.project a').click(addProjectDetails);

  $('#colorBtn').click(randomizeColors);
  $("#testjs").click(function(e) {
    $.get("http://URL", callBackFn);

  });
}

function callBackFn (result) {
  var projectHTML = '<a href="#" class ="thumbnail">' + 
    '<img src="' + result['image'] + '" class="detailsImage">' +
    '<p>' + result['title'] + '</p>' +
    '<p><small>' + result['date'] + '</small></p></a>'+
    '<p>' + result['summary'] +'</p>';

  $("#project" + result['id']).html(projectHTML);

}


//$.post("http://URL", {"json":"json"}, callBa

/*
 * Make an AJAX call to retrieve project details and add it in
 */
function addProjectDetails(e) {
  // Prevent following the link
  e.preventDefault();

  // Get the div ID, e.g., "project3"
  var projectID = $(this).closest('.project').attr('id');
  // get rid of 'project' from the front of the id 'project3'
  var idNumber = projectID.substr('project'.length);

  console.log("User clicked on project " + idNumber);
  var projURL = "/project/" +idNumber;
  console.log("Project URL is "+ projURL);
  $.get(projURL, callBackFn); 


}

/*
 * Make an AJAX call to retrieve a color palette for the site
 * and apply it
 */
function randomizeColors(e) {
  $.get("/palette", colorCallBack);
}

function colorCallBack () {
	var tmp = result['colors'];
	var colors = tmp['hex'];
  $('body').css('background-color', colors[0]);
  $('.thumbnail').css('background-color', colors[1]);
  $('h1, h2, h3, h4, h5, h5').css('color', colors[2]);
  $('p').css('color', colors[3]);
  $('.project img').css('opacity', .75);
}
{'fraction_non_alphanumeric': 0.19032258064516128, 'fraction_numerical': 0.005734767025089606, 'mean_word_length': 4.074545454545454, 'pattern_counts': {'":': 1, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5142109', 'n_tokens_mistral': 905, 'n_tokens_neox': 890, 'n_words': 267}