weather/js/function.js
//hides and unhides getting location status
hides and unhides getting location status
hides and unhides getting location status
function displayData(data){
  const noStatus = document.getElementById("status");
  noStatus.setAttribute("id", "noStatus");
  const hide = document.getElementById("hideUnhide");
  hide.setAttribute("class", "notHide");
  const cityState=data.current_observation.display_location.full;
  console.log(cityState);
  document.getElementById("cityName").innerHTML=cityState;
  const LAT=data.current_observation.display_location.latitude;
  const LONG=data.current_observation.display_location.longitude;
  document.getElementById("location").innerHTML="<b>Location: </b>" + LAT + "&deg;N, " + LONG + "&deg;W";
  const zip=data.current_observation.display_location.zip;
  console.log(zip);
  document.getElementById("zip").innerHTML="<b>Zip: </b>" + zip +" |";
  const elevation=data.current_observation.display_location.elevation;
  console.log(elevation);
  document.getElementById("elevation").innerHTML="<b>Elevation: </b>" + Math.round(elevation * 3.28) + "ft. |";
  const temp=data.current_observation.temp_f;
  console.log(temp);
  document.getElementById("mainTemp").innerHTML=Math.round(temp)+'&deg;F';
  const speed=data.current_observation.wind_mph;
  console.log(speed);
  document.getElementById("windSpeed").innerHTML=speed+ " mph";
  buildWC(speed, temp);
  console.log(buildWC);
  const high=data.forecast.simpleforecast.forecastday[0].high.fahrenheit;
  console.log(high);
  document.getElementById("max").innerHTML=Math.round(high)+'&deg;F';
  const low=data.forecast.simpleforecast.forecastday[0].low.fahrenheit;
  console.log(low);
  document.getElementById("min").innerHTML=Math.round(low);+'&deg;F';
  const gusts=data.current_observation.wind_gust_mph;
  console.log(gusts);
  document.getElementById("gust").innerHTML="<b>Gusts:</b>" + gusts + "mph";
  const direction=data.current_observation.wind_dir;
  console.log(direction);
  document.getElementById("windDirection").innerHTML="<b>Direction: </b>" + direction;
  windDial(direction);
  let WEATHERCOND=data.current_observation.weather;
  console.log(WEATHERCOND.toLowerCase());
  document.getElementById("condition").innerHTML=WEATHERCOND;
  let condResult= getCondition(WEATHERCOND.toLowerCase());
  console.log(condResult);
  changeSummaryImage(condResult);
  let condIcon=data.current_observation.icon_url;
  document.getElementById("conditionIcon").src=condIcon;
  let footerImage=data.current_observation.image.url;
  console.log(footerImage);
  document.getElementById("footerImage").src=footerImage;
}
function displayData ( data ) { const noStatus = document . getElementById ( "status" ) ; noStatus . setAttribute ( "id" , "noStatus" ) ; const hide = document . getElementById ( "hideUnhide" ) ; hide . setAttribute ( "class" , "notHide" ) ; const cityState = data . current_observation . display_location . full ; console . log ( cityState ) ; document . getElementById ( "cityName" ) . innerHTML = cityState ; const LAT = data . current_observation . display_location . latitude ; const LONG = data . current_observation . display_location . longitude ; document . getElementById ( "location" ) . innerHTML = "<b>Location: </b>" + LAT + "&deg;N, " + LONG + "&deg;W" ; const zip = data . current_observation . display_location . zip ; console . log ( zip ) ; document . getElementById ( "zip" ) . innerHTML = "<b>Zip: </b>" + zip + " |" ; const elevation = data . current_observation . display_location . elevation ; console . log ( elevation ) ; document . getElementById ( "elevation" ) . innerHTML = "<b>Elevation: </b>" + Math . round ( elevation * 3.28 ) + "ft. |" ; const temp = data . current_observation . temp_f ; console . log ( temp ) ; document . getElementById ( "mainTemp" ) . innerHTML = Math . round ( temp ) + '&deg;F' ; const speed = data . current_observation . wind_mph ; console . log ( speed ) ; document . getElementById ( "windSpeed" ) . innerHTML = speed + " mph" ; buildWC ( speed , temp ) ; console . log ( buildWC ) ; const high = data . forecast . simpleforecast . forecastday [ 0 ] . high . fahrenheit ; console . log ( high ) ; document . getElementById ( "max" ) . innerHTML = Math . round ( high ) + '&deg;F' ; const low = data . forecast . simpleforecast . forecastday [ 0 ] . low . fahrenheit ; console . log ( low ) ; document . getElementById ( "min" ) . innerHTML = Math . round ( low ) ; + '&deg;F' ; const gusts = data . current_observation . wind_gust_mph ; console . log ( gusts ) ; document . getElementById ( "gust" ) . innerHTML = "<b>Gusts:</b>" + gusts + "mph" ; const direction = data . current_observation . wind_dir ; console . log ( direction ) ; document . getElementById ( "windDirection" ) . innerHTML = "<b>Direction: </b>" + direction ; windDial ( direction ) ; let WEATHERCOND = data . current_observation . weather ; console . log ( WEATHERCOND . toLowerCase ( ) ) ; document . getElementById ( "condition" ) . innerHTML = WEATHERCOND ; let condResult = getCondition ( WEATHERCOND . toLowerCase ( ) ) ; console . log ( condResult ) ; changeSummaryImage ( condResult ) ; let condIcon = data . current_observation . icon_url ; document . getElementById ( "conditionIcon" ) . src = condIcon ; let footerImage = data . current_observation . image . url ; console . log ( footerImage ) ; document . getElementById ( "footerImage" ) . src = footerImage ; }
hides and unhides getting location status
hides and unhides getting location status
//populate location information //populate windchill information and temperature information //Cannot find the correct path to dispaly low and high temperature. I made a place holder in the mean time. //get weather conditions //  //get hourly temperature from API //  const hourly= data.current_observation.hourly_url; //  console.log(hourly); //  document.getElementById("hourlyTemp").innerHTML="Hourly Forecast" + hourly;