<commit_before>/*
*maps.js handles the canvas that holds the map of the USA
*/

//This variable handles how many milliseconds the various animations take to perform
var delay = 500;

//Perform this code once the page is fully loaded
$(document).ready(function() {
	
	$.ajax(
		"../lib/Init.php",
		{
			data: "",
			dataType: "json",
			type: "GET",
			success: function(data, textStatus, jqXHR) {
			
				var races = data.race;
				for(i=0;i<races.length;i++) {
					$("#raceBox").append("<option value=\"" + races[i].name + "\">" + races[i].description + "</option>");
				}
				
				var ages = data.age;
				for(i=0;i<ages.length;i++) {
					$("#ageBox").append("<option value=\"" + ages[i].id  +"\">" + ages[i].name + "</option>");
				}
			},
			error: function() {
				
				// Error Handling here
			}
		}
	);

	$("#back_button").hide();
	$("area").click(function() {
		var clicked = $(this);
		goToState(clicked);
		return false;
	});
	$("#stateBox").change(function() {
		//Get the current text value from the selector
		var curVal = $("#stateBox option:selected").text();
		if(curVal != "NULL")
		{
			getCountiesForState(curVal);
		}
		var state = $("area[title='" + curVal + "']");
		goToState(state);
	});
	
	$("#countyBox").change(function() { notNull(); });
	$("#ageBox").change(function() { notNull(); });
	$("#raceBox").change(function() { notNull(); });
	$("#genderBox").change(function() { notNull(); });
});

//Change from usa image to image of selected state
function goToState(stateObj) {
	$("#usa").hide(delay);
	$("#back_button").show(delay);
	$("#map_div").append("<br class='state'><img class='state' src='img/state/" + stateObj.attr("alt") + ".gif'></img>");
	$("#stateBox, #statePara").hide(delay);
	getCountiesForState(stateObj.attr("title"));
}

//Go back to full usa map
function goBack() {
	$("#map_div").children(".state, #button").hide(delay, function() { $(this).remove(); });
	$("#back_button").hide(delay);
	$("#usa").show(delay);
	$("#stateBox, #statePara").show(delay);
	$('#stateBox option').eq(0).prop('selected', true);
	$('#countyBox').find('option').remove().end().append('<option value="NULL">- none -</option>').val('NULL');
}<commit_msg>hide demographics div when back button is pressed<commit_after>/*
*maps.js handles the canvas that holds the map of the USA
*/

//This variable handles how many milliseconds the various animations take to perform
var delay = 500;

//Perform this code once the page is fully loaded
$(document).ready(function() {
	
	$.ajax(
		"../lib/Init.php",
		{
			data: "",
			dataType: "json",
			type: "GET",
			success: function(data, textStatus, jqXHR) {
			
				var races = data.race;
				for(i=0;i<races.length;i++) {
					$("#raceBox").append("<option value=\"" + races[i].name + "\">" + races[i].description + "</option>");
				}
				
				var ages = data.age;
				for(i=0;i<ages.length;i++) {
					$("#ageBox").append("<option value=\"" + ages[i].id  +"\">" + ages[i].name + "</option>");
				}
			},
			error: function() {
				
				// Error Handling here
			}
		}
	);

	$("#back_button").hide();
	$("area").click(function() {
		var clicked = $(this);
		goToState(clicked);
		return false;
	});
	$("#stateBox").change(function() {
		//Get the current text value from the selector
		var curVal = $("#stateBox option:selected").text();
		if(curVal != "NULL")
		{
			getCountiesForState(curVal);
		}
		var state = $("area[title='" + curVal + "']");
		goToState(state);
	});
	
	$("#countyBox").change(function() { notNull(); });
	$("#ageBox").change(function() { notNull(); });
	$("#raceBox").change(function() { notNull(); });
	$("#genderBox").change(function() { notNull(); });
});

//Change from usa image to image of selected state
function goToState(stateObj) {
	$("#usa").hide(delay);
	$("#back_button").show(delay);
	$("#map_div").append("<br class='state'><img class='state' src='img/state/" + stateObj.attr("alt") + ".gif'></img>");
	$("#stateBox, #statePara").hide(delay);
	getCountiesForState(stateObj.attr("title"));
}

//Go back to full usa map
function goBack() {
	$("#map_div").children(".state, #button").hide(delay, function() { $(this).remove(); });
	$("#back_button").hide(delay);
	$("#usa").show(delay);
	$("#stateBox, #statePara").show(delay);
	$('#stateBox option').eq(0).prop('selected', true);
	$('#countyBox').find('option').remove().end().append('<option value="NULL">- none -</option>').val('NULL');
	$("#demographics").hide(500);
}
{'fraction_non_alphanumeric': 0.24317617866004962, 'fraction_numerical': 0.003383713061132416, 'mean_word_length': 4.259786476868327, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 21, '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': '862572', 'n_tokens_mistral': 1643, 'n_tokens_neox': 1501, 'n_words': 314}