<commit_before>var weather;
var $zip = 37206;
var unspecified = 'http://api.wunderground.com/api/7d2491b5dd06b094/geolookup/forecast10day/q/';
var $ul = document.querySelector('#daily-forcast');
var url = 'http://api.wunderground.com/api/7d2491b5dd06b094/geolookup/forecast10day/q/' + $zip + '.json';
var $button = document.querySelector('.submit');  
var $city = document.querySelector('.city');
var geo = document.querySelector('.geo');
var todayIcon = document.querySelector('.todayIcon');

function myAwesomeFunction(data){ 
   weather = data;
  if (weather.response.error) {
    alert("Please enter a valid zipcode");
  } else {
     $city.innerHTML = weather.location.city + ', ' + weather.location.state;  
      var logo = document.createElement('img');
      logo.src = weather.forecast.simpleforecast.forecastday[0].icon_url; 
      todayIcon.appendChild(logo);

      for(var i = 0; i <5; i++) {
       var $img = document.createElement('img');
       $img.src = weather.forecast.simpleforecast.forecastday[i].icon_url;
      var month = weather.forecast.simpleforecast.forecastday[i].date.monthname;
      var numDay = weather.forecast.simpleforecast.forecastday[i].date.day;
      var day = weather.forecast.simpleforecast.forecastday[i].date.weekday;
      var highTemp = weather.forecast.simpleforecast.forecastday[i].high.fahrenheit;
      var lowTemp = weather.forecast.simpleforecast.forecastday[i].low.fahrenheit;
      var note = weather.forecast.txt_forecast.forecastday[i].fcttext;
      var $li = document.createElement('li');
      $li.className = "days";
      $li.innerHTML = "<span class='first-line'>" + day + "," + " " + month + " " + numDay +  ":" + " High of " + highTemp + " &amp; " + "Low of " + lowTemp + "</span>" + "<br />" + "<span class='note'>" + note + "</span";
      $li.appendChild($img);
      $ul.appendChild($li);
  }
 }
}

function getJSONP(url, cbName){
  var $script = document.createElement('script');
  $script.src = url + '?callback=' + cbName;
  document.body.appendChild($script);
}

function myLocation(position) {
  var lat = position.coords.latitude;
  var lng = position.coords.longitude;
  console.log(lat, lng);
  place = lat + ',' + lng;
  $ul.innerHTML = '';
  var newUrl = unspecified + place + '.json';
  getJSONP(newUrl, 'myAwesomeFunction');
} 

$(document).ready(function(){
        getJSONP(url, 'myAwesomeFunction');
        $button.addEventListener('click', function() {
        $zip = document.querySelector('.zip').value;
        if($zip.length != 5){
                alert('Please enter valid zip code');
        } else {
        $ul.innerHTML="";
        var newZip = unspecified + $zip + '.json';
        getJSONP(newZip, 'myAwesomeFunction');
        }
    }); 
    geo.addEventListener('click', function(){
      navigator.geolocation.getCurrentPosition(myLocation);
    })        
});


<commit_msg>fixed logo to replaceChild method<commit_after>var weather;
var $zip = 37206;
var unspecified = 'http://api.wunderground.com/api/7d2491b5dd06b094/geolookup/forecast10day/q/';
var $ul = document.querySelector('#daily-forcast');
var url = 'http://api.wunderground.com/api/7d2491b5dd06b094/geolookup/forecast10day/q/' + $zip + '.json';
var $button = document.querySelector('.submit');  
var $city = document.querySelector('.city');
var geo = document.querySelector('.geo');
var todayIcon = document.querySelector('.todayIcon');

function myAwesomeFunction(data){ 
   weather = data;
  if (weather.response.error) {
    alert("Please enter a valid zipcode");
  } else {
     $city.innerHTML = weather.location.city + ', ' + weather.location.state;  
      var logo = document.createElement('img');
      logo.src = weather.forecast.simpleforecast.forecastday[0].icon_url;
      
      if ( $(".todayIcon").children().length > 0) {
        todayIcon.replaceChild(logo, logo);
      } else {
        todayIcon.appendChild(logo);        
      }

      for(var i = 0; i <5; i++) {
       var $img = document.createElement('img');
       $img.src = weather.forecast.simpleforecast.forecastday[i].icon_url;
      var month = weather.forecast.simpleforecast.forecastday[i].date.monthname;
      var numDay = weather.forecast.simpleforecast.forecastday[i].date.day;
      var day = weather.forecast.simpleforecast.forecastday[i].date.weekday;
      var highTemp = weather.forecast.simpleforecast.forecastday[i].high.fahrenheit;
      var lowTemp = weather.forecast.simpleforecast.forecastday[i].low.fahrenheit;
      var note = weather.forecast.txt_forecast.forecastday[i].fcttext;
      var $li = document.createElement('li');
      $li.className = "days";
      $li.innerHTML = "<span class='first-line'>" + day + "," + " " + month + " " + numDay +  ":" + " High of " + highTemp + " &amp; " + "Low of " + lowTemp + "</span>" + "<br />" + "<span class='note'>" + note + "</span";
      $li.appendChild($img);
      $ul.appendChild($li);
  }
 }
}

function getJSONP(url, cbName){
  var $script = document.createElement('script');
  $script.src = url + '?callback=' + cbName;
  document.body.appendChild($script);
}

function myLocation(position) {
  var lat = position.coords.latitude;
  var lng = position.coords.longitude;
  console.log(lat, lng);
  place = lat + ',' + lng;
  $ul.innerHTML = '';
  var newUrl = unspecified + place + '.json';
  getJSONP(newUrl, 'myAwesomeFunction');
} 

$(document).ready(function(){
        getJSONP(url, 'myAwesomeFunction');
        $button.addEventListener('click', function() {
        $zip = document.querySelector('.zip').value;
        if($zip.length != 5){
                alert('Please enter valid zip code');
        } else {
        $ul.innerHTML="";
        var newZip = unspecified + $zip + '.json';
        getJSONP(newZip, 'myAwesomeFunction');
        }
    }); 
    geo.addEventListener('click', function(){
      navigator.geolocation.getCurrentPosition(myLocation);
    })        
});



{'fraction_non_alphanumeric': 0.16449483838212894, 'fraction_numerical': 0.012015569470299543, 'mean_word_length': 3.387527839643653, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 12, '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': '2661282', 'n_tokens_mistral': 1952, 'n_tokens_neox': 1877, 'n_words': 334}