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

	//get species data from database
	$.post('/speciesnames', function(species){
		autocomplete("#species-search-input", species);
	});

	$.post('/speciesnames', function(species) {
		autocomplete('#species-input-instructions', species);
	});

	var autocomplete = function(selector, species) {
		$(selector).autocomplete({
			source: species,
    	minLength: 3,
  	});
	}

	var hideAllOverlays = function() {
		$(".overlay").hide();
	};

	$('#search-link').on('click', function() {
		hideAllOverlays();
		$("#search.overlay").show();

	});	

	//random animal show modal

	$('#random-animal-link').on('click', function() {
		hideAllOverlays();
		$.get('/species/random', function(data) {
			$("#species-card.overlay").html(data);
			$("#species-card.overlay").show();
		});
	});

	//animal modal
	
	$(document).on('click', '.relative.card', function(event) {
		event.preventDefault();
		hideAllOverlays();
		var animalId = $(this).attr('id')
		$.get('/card', {animal_id: animalId}, function(data) {
			$("#species-card.overlay").html(data);
			$("#species-card.overlay").show();
		});
	});

	//search modal

	$('#species-search-input-submit').on('click', function(event) {
		event.preventDefault();
		hideAllOverlays();
		var searchInput = $('#species-search-input').val();
		console.log(searchInput)
		$.post('/species/search', {animal: searchInput}, function(data) {
			$("#species-card.overlay").html(data);
			$("#species-card.overlay").show();
		});
	});
	
  // _____________________________
  // This is the card modal

  $('.card').on('click', function(event) {
    event.preventDefault();
    hideAllOverlays();
    $("#species-card.overlay").show();

  });
  
  $('.overlay').on('click', '.exit',  hideAllOverlays)
  // ______________________________

    
 

    //probably not finished
    $("#add-card-button").on("click", function(event) {
    	event.preventDefault();
    	event.stopPropagation();
    	var specId = parseInt($('#current-species-id').html());
    	$.post('/add_to_collection', {species_id: specId}, function(message) {
			console.log(message);
		}); 
    });
    
	//search for species in database
	// $('#species-search').on('submit', function(event){
	// 	event.preventDefault();
	// 	var species = $('input').val();
	// 	$.post('/species', {species: species}, function(foundSpecies){
	// 		console.log(foundSpecies)
	// 	});
	// });

});//end doc ready<commit_msg>moved some methods, added notes<commit_after>$(document).ready(function() {

	//get species data from database
	$.post('/speciesnames', function(species){
		autocomplete("#species-search-input", species);
	});

	$.post('/speciesnames', function(species) {
		autocomplete('#species-input-instructions', species);
	});

	var autocomplete = function(selector, species) {
		$(selector).autocomplete({
			source: species,
    	minLength: 3,
  	});
	}

	var hideAllOverlays = function() {
		$(".overlay").hide();
	};

	//search link, shows modal

	$('#search-link').on('click', function() {
		hideAllOverlays();
		$("#search.overlay").show();

	});	

	//random animal link, shows modal

	$('#random-animal-link').on('click', function() {
		hideAllOverlays();
		$.get('/species/random', function(data) {
			$("#species-card.overlay").html(data);
			$("#species-card.overlay").show();
		});
	});

	//animal modal

  $('.card').on('click', function(event) {
    event.preventDefault();
    hideAllOverlays();
    $("#species-card.overlay").show();
  });
  
  $('.overlay').on('click', '.exit',  hideAllOverlays)

  //relative links for animal modal
	
	$(document).on('click', '.relative.card', function(event) {
		event.preventDefault();
		hideAllOverlays();
		var animalId = $(this).attr('id')
		$.get('/card', {animal_id: animalId}, function(data) {
			$("#species-card.overlay").html(data);
			$("#species-card.overlay").show();
		});

	//search modal

	$('#species-search-input-submit').on('click', function(event) {
		event.preventDefault();
		hideAllOverlays();
		var searchInput = $('#species-search-input').val();
		console.log(searchInput)
		$.post('/species/search', {animal: searchInput}, function(data) {
			$("#species-card.overlay").html(data);
			$("#species-card.overlay").show();
		});
	});
		
    //probably not finished
    $("#add-card-button").on("click", function(event) {
    	event.preventDefault();
    	event.stopPropagation();
    	var specId = parseInt($('#current-species-id').html());
    	$.post('/add_to_collection', {species_id: specId}, function(message) {
			console.log(message);
		}); 
    });
    
	//search for species in database
	// $('#species-search').on('submit', function(event){
	// 	event.preventDefault();
	// 	var species = $('input').val();
	// 	$.post('/species', {species: species}, function(foundSpecies){
	// 		console.log(foundSpecies)
	// 	});
	// });

});//end doc ready
{'fraction_non_alphanumeric': 0.22478386167146974, 'fraction_numerical': 0.0004116920543433512, 'mean_word_length': 3.9938335046248716, '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': '2193558', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1543, 'n_words': 250}