<commit_before>(function() {
	var API_KEY = "API KEY HERE";

	var baseUrl = "http://api.wunderground.com/api/"
	var query = "/conditions/almanac/forecast10day/tide/hourly10day/q/";
	var location = "";

	var user_latitude;
	var user_longitude;

	var state = "";
	var city = "";

	//info to fill from json
	var hourly_forecast;
	var temps_f;
	var forecast_days;
	var tide_info;
	var graphNum = 0;

	var todayInt;

	var recordHigh;
	var recordLow;

	//fix geolocation in the future

	// if (navigator.geolocation) {
	//   navigator.geolocation.getCurrentPosition(searchPosition, error);
	// } else {
	//   error('not supported');
	// }

	// function displayError(error) {
	//   var errors = {
	//     1: 'Permission denied',
	//     2: 'Position unavailable',
	//     3: 'Request timeout'
	//   };
	//   alert("Error: " + errors[error.code]);
	//   $('#error').text(errors[error.code]);
	// }

	// function searchPosition() {
	// 	user_latitude = position.coords.latitude;
	// 	user_longitude = position.coords.longitude;

	// 	location =
	// 	getData();
	// }

	$('#today').text($.datepicker.formatDate('M d, yy', new Date()));
	setDates();
	//def
	getData("San_Francisco,_California");

	//set date
	function setDates() {
		var today = new Date();
		var d = today.getDate();
	   	var m = today.getMonth();
	   	var y = today.getYear();
	   	todayInt = today.getDay();
	   	var dayName = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
  		$('#day1').text($.datepicker.formatDate('D', today));
		$('#day2').text(dayName[(today.getDay()+1) % 7]);
		$('#day3').text(dayName[(today.getDay()+2) % 7]);
		$('#day4').text(dayName[(today.getDay()+3) % 7]);
		$('#day5').text(dayName[(today.getDay()+4) % 7]);
	}

	function fadeIn(selection,html) {
		$(selection).fadeOut(function() {
			var align_html = "<div class=\"tc\">" + html + "</div>";
			$(this).html(align_html).fadeIn();
		});}

	//on form submit
	$("form").submit(function() {
		if ($("#location").val() == "") {
			return true;
		}
		else {
			//check input by removing special characters and trim spaces
			location = $("#location").val().trim();
			// if (location.indexOf(',') == -1) {
			// location = location.replace(/[^\w\s]/gi, '');
			location = location.replace(" ","_");
			getData(location);
			return false;
		}
	});

	function getData(location) {
		// console.log(location);
		if (true) {
			$.ajax({
				url: baseUrl + API_KEY + "/geolookup/q/" + location + ".json",
				dataType: "jsonp",
				success: function(stateData) {
				    // get state and rewrite query if they only put the city
				    if (location.indexOf('_') == -1) {
						state = stateData['response']['results'][0]['state'];
				    	city = stateData['response']['results'][0]['city'];
				    	location = state + "/" + location;
				    }
				    else {
				    	state = stateData['location']['state'];
				    	city = stateData['location']['city'];
				    }

				    $('#city').text(city + ", " + state);

				    console.log(baseUrl + API_KEY + query + location + ".json");

				    $.ajax({
						url: baseUrl + API_KEY + query + location + ".json",
						dataType: "jsonp",
						success: function(weatherData) {
							success(weatherData);
						}
					});
				}
			});
		}
		else {
			$.ajax({
				url: "test.json",
				type : 'GET',
				dataType: "json",
				success: function(weatherData) {
					success(weatherData);
				}
			});
		}
	}

	function success(weatherData) {
		 // use the JSON data here for your visualization
		var city_state = weatherData['current_observation']['display_location']['full'];
	    var last_update = weatherData['current_observation']['observation_time'];
	    var weather = weatherData['current_observation']['weather'];
	    var curr_temp = weatherData['current_observation']['temp_f'];//['temperature_string'];
	    var forecast_img = weatherData['current_observation']['icon_url'];
	    var wind_mph = weatherData['current_observation']['wind_mph'];
	    var wind_dir = weatherData['current_observation']['wind_dir'];
	    var curr_humidity = weatherData['current_observation']['relative_humidity'];

	    //current condition/icon + last update
	    $("#lastUpdated").text(last_update);
	    $('#condition').text(weather);
	    $('#city').text(city_state);
	    // console.log(weather.toLowerCase());
	    if (true) {

	    	if ((new Date()).getHours() > 19) {
	    		$('.hero-unit').css('background','url(' + weather.toLowerCase().replace('heavy','').replace('light','').replace(' ','') + '_night.jpg) no-repeat');
				$('.hero-unit').css('color','white');
	    	}
	    	else {
	    		$('.hero-unit').css('background','url(' + weather.toLowerCase().replace('heavy','').replace('light','').replace(' ','') + '.jpg) no-repeat');
	    		$('.hero-unit').css('color','black');
	    	}
	    	if (weather == "Overcast")
	    		$('.hero-unit').css('color','darkorange');

	    	$('.hero-unit').css('background-size','cover');
	    	$('.hero-unit').css('background-position','50% 50%');

	    }
	    $('#current').html("Temp: " + curr_temp+" F <br>" + "Wind: " + wind_mph + " mph" + " " + wind_dir + "<br>Humidity: " + curr_humidity);
	    $('#forecast_icon').attr('src',forecast_img);

	    hourly_forecast = weatherData['hourly_forecast'];//.slice(0,24);

	    forecast_days = weatherData['forecast']['simpleforecast']['forecastday'];
	    tide_info = weatherData['tide']['tideSummary'];//.slice(0,24);
	    recordHigh = weatherData['almanac']['temp_high']['record']['F'];
	    recordLow = weatherData['almanac']['temp_low']['record']['F'];

	    displayGraphs();
	}

	$('#view_temp').click(function() {
		$('#view_temp').addClass('btn-primary');
		$('#view_humidity').removeClass('btn-primary');
		$('#view_tides').removeClass('btn-primary btn-danger');
		// $("#heat").removeAttr("disabled");<commit_msg>fix pictures not showing up correctly<commit_after>(function() {
	var API_KEY = "19c20b1e664e79a6";

	var baseUrl = "http://api.wunderground.com/api/"
	var query = "/conditions/almanac/forecast10day/tide/hourly10day/q/";
	var location = "";

	var user_latitude;
	var user_longitude;

	var state = "";
	var city = "";

	//info to fill from json
	var hourly_forecast;
	var temps_f;
	var forecast_days;
	var tide_info;
	var graphNum = 0;

	var todayInt;

	var recordHigh;
	var recordLow;

	var conditionMap = {
		'Drizzle'                      : 'Drizzle',
		'Rain'                         : 'Rain',
		'Snow'                         : 'Snow',
		'Snow Grains'                  : 'Snow',
		'Ice Crystals'                 : 'Snow',
		'Ice Pellets'                  : 'Snow',
		'Hail'                         : 'Rain',
		'Mist'                         : 'Rain',
		'Fog'                          : 'Rain',
		'Fog Patches'                  : 'Rain',
		'Smoke'                        : 'Rain',
		'Volcanic Ash'                 : 'Rain',
		'Widespread Dust'              : 'Rain',
		'Sand'                         : 'Rain',
		'Haze'                         : 'Rain',
		'Spray'                        : 'Rain',
		'Dust Whirls'                  : 'Rain',
		'Sandstorm'                    : 'Rain',
		'Low Drifting Snow'            : 'Snow',
		'Low Drifting Widespread Dust' : 'Rain',
		'Low Drifting Sand'            : 'Rain',
		'Blowing Snow'                 : 'Snow',
		'Blowing Widespread Dust'      : 'Rain',
		'Blowing Sand'                 : 'Rain',
		'Rain Mist'                    : 'Rain',
		'Rain Showers'                 : 'Rain',
		'Snow Showers'                 : 'Snow',
		'Snow Blowing Snow Mist'       : 'Snow',
		'Ice Pellet Showers'           : 'Snow',
		'Hail Showers'                 : 'Rain',
		'Small Hail Showers'           : 'Rain',
		'Thunderstorm'                 : 'Rain',
		'Thunderstorms and Rain'       : 'Rain',
		'Thunderstorms and Snow'       : 'Snow',
		'Thunderstorms and Ice Pellets': 'Snow',
		'Thunderstorms with Hail'      : 'Rain',
		'Thunderstorms with Small Hail': 'Rain',
		'Freezing Drizzle'             : 'Drizzle',
		'Freezing Rain'                : 'Rain',
		'Freezing Fog'                 : 'Rain',
		'Patches of Fog'               : 'Rain',
		'Shallow Fog'                  : 'Rain',
		'Partial Fog'                  : 'Rain',
		'Overcast'                     : 'Overcast',
		'Clear'                        : 'Clear',
		'Partly Cloudy'                : 'Partly Cloudy',
		'Mostly Cloudy'                : 'Mostly Cloudy',
		'Scattered Clouds'             : 'Partly Cloudy',
		'Small Hail'                   : 'Rain',
		'Squalls'                      : 'Rain',
		'Funnel Cloud'                 : 'Rain',
		'Unknown Precipitation'        : 'Rain',
		'Unknown'                      : 'Clear'
	}

	//fix geolocation in the future

	// if (navigator.geolocation) {
	//   navigator.geolocation.getCurrentPosition(searchPosition, error);
	// } else {
	//   error('not supported');
	// }

	// function displayError(error) {
	//   var errors = {
	//     1: 'Permission denied',
	//     2: 'Position unavailable',
	//     3: 'Request timeout'
	//   };
	//   alert("Error: " + errors[error.code]);
	//   $('#error').text(errors[error.code]);
	// }

	// function searchPosition() {
	// 	user_latitude = position.coords.latitude;
	// 	user_longitude = position.coords.longitude;

	// 	location =
	// 	getData();
	// }

	$('#today').text($.datepicker.formatDate('M d, yy', new Date()));
	setDates();
	//def
	getData("San_Francisco,_California");

	//set date
	function setDates() {
		var today = new Date();
		var d = today.getDate();
	   	var m = today.getMonth();
	   	var y = today.getYear();
	   	todayInt = today.getDay();
	   	var dayName = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
  		$('#day1').text($.datepicker.formatDate('D', today));
		$('#day2').text(dayName[(today.getDay()+1) % 7]);
		$('#day3').text(dayName[(today.getDay()+2) % 7]);
		$('#day4').text(dayName[(today.getDay()+3) % 7]);
		$('#day5').text(dayName[(today.getDay()+4) % 7]);
	}

	function fadeIn(selection,html) {
		$(selection).fadeOut(function() {
			var align_html = "<div class=\"tc\">" + html + "</div>";
			$(this).html(align_html).fadeIn();
		});}

	//on form submit
	$("form").submit(function() {
		if ($("#location").val() == "") {
			return true;
		}
		else {
			//check input by removing special characters and trim spaces
			location = $("#location").val().trim();
			// if (location.indexOf(',') == -1) {
			// location = location.replace(/[^\w\s]/gi, '');
			location = location.replace(" ","_");
			getData(location);
			return false;
		}
	});

	function getData(location) {
		// console.log(location);
		if (true) {
			$.ajax({
				url: baseUrl + API_KEY + "/geolookup/q/" + location + ".json",
				dataType: "jsonp",
				success: function(stateData) {
				    // get state and rewrite query if they only put the city
				    if (location.indexOf('_') == -1) {
						state = stateData['response']['results'][0]['state'];
				    	city = stateData['response']['results'][0]['city'];
				    	location = state + "/" + location;
				    }
				    else {
				    	if (stateData['location']) {
				    		state = stateData['location']['state'];
				    		city = stateData['location']['city'];

						    $('#city').text(city + ", " + state);

						    console.log(baseUrl + API_KEY + query + location + ".json");

						    $.ajax({
								url: baseUrl + API_KEY + query + location + ".json",
								dataType: "jsonp",
								success: function(weatherData) {
									success(weatherData);
								}
							});
				    	}
				    }

				}
			});
		}
		else {
			$.ajax({
				url: "test.json",
				type : 'GET',
				dataType: "json",
				success: function(weatherData) {
					success(weatherData);
				}
			});
		}
	}

	function success(weatherData) {
		 // use the JSON data here for your visualization
		var city_state = weatherData['current_observation']['display_location']['full'];
	    var last_update = weatherData['current_observation']['observation_time'];
	    var weather = weatherData['current_observation']['weather'];
	    var curr_temp = weatherData['current_observation']['temp_f'];//['temperature_string'];
	    var forecast_img = weatherData['current_observation']['icon_url'];
	    var wind_mph = weatherData['current_observation']['wind_mph'];
	    var wind_dir = weatherData['current_observation']['wind_dir'];
	    var curr_humidity = weatherData['current_observation']['relative_humidity'];

	    //current condition/icon + last update
	    $("#lastUpdated").text(last_update);
	    $('#condition').text(weather);
	    $('#city').text(city_state);
	    // console.log(weather.toLowerCase());
	    if (true) {
	    	var mappedCondition = conditionMap[weather] || weather;
	    	if ((new Date()).getHours() > 19 && mappedCondition == 'Partly Cloudy') {
	    		$('.hero-unit').css('background','url(' + mappedCondition.toLowerCase().replace('heavy','').replace('light','').replace(' ','') + '_night.jpg) no-repeat');
				$('.hero-unit').css('color','white');
	    	}
	    	else {
	    		$('.hero-unit').css('background','url(' + mappedCondition.toLowerCase().replace('heavy','').replace('light','').replace(' ','') + '.jpg) no-repeat');
	    		$('.hero-unit').css('color','black');
	    	}
	    	if (mappedCondition == "Overcast")
	    		$('.hero-unit').css('color','darkorange');

	    	$('.hero-unit').css('background-size','cover');
	    	$('.hero-unit').css('background-position','50% 50%');

	    }
	    $('#current').html("Temp: " + curr_temp+" F <br>" + "Wind: " + wind_mph + " mph" + " " + wind_dir + "<br>Humidity: " + curr_humidity);
	    $('#forecast_icon').attr('src',forecast_img);

	    hourly_forecast = weatherData['hourly_forecast'];//.slice(0,24);

	    forecast_days = weatherData['forecast']['simpleforecast']['forecastday'];
	    tide_info = weatherData['tide']['tideSummary'];//.slice(0,24);
	    recordHigh = weatherData['almanac']['temp_high']['record']['F'];
	    recordLow = weatherData['almanac']['temp_low']['record']['F'];

	    displayGraphs();
	}

	$('#view_temp').click(function() {
		$('#view_temp').addClass('btn-primary');
		$('#view_humidity').removeClass('btn-primary');
		$('#view_tides').removeClass('btn-primary btn-danger');
		// $("#heat").removeAttr("disabled");
{'fraction_non_alphanumeric': 0.2002543810062182, 'fraction_numerical': 0.006006218202374223, 'mean_word_length': 2.7156734050932, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '6902672', 'n_tokens_mistral': 5229, 'n_tokens_neox': 4557, 'n_words': 842}