Skip to content

Commit

Permalink
resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaylorjr committed Jan 22, 2017
1 parent 404221c commit 960b449
Showing 1 changed file with 85 additions and 89 deletions.
174 changes: 85 additions & 89 deletions scripts/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,146 +13,142 @@ function geoLocation() {


//Google Maps API to return printed location as opposed to lat/lon coordinates.
<<
<< << < HEAD

$.getJSON('https://maps.googleapis.com/maps/api/geocode/json?latlng=' + latitude + ',' + longitude + '&key=YOUR-API-KEY', function(city) {

===
=== =
$.getJSON('https://maps.googleapis.com/maps/api/geocode/json?latlng=' + latitude + ',' + longitude + '&key=YOUR-API-KEY', function(city) { >>>
>>> > staging
$.getJSON('https://maps.googleapis.com/maps/api/geocode/json?latlng=' + latitude + ',' + longitude + '&key=YOUR-API-KEY', function(city) {

var address = city.results[2].formatted_address;

var address = city.results[2].formatted_address;

var userAddressObj = document.getElementById(userAddress);

userAddress.innerHTML = "<p>Current condtions for " + address;
var userAddressObj = document.getElementById(userAddress);

});
userAddress.innerHTML = "<p>Current condtions for " + address;

//current conditions api from Darksky.net and variables for printing inside app.
});

$.ajax({
url: 'https://api.darksky.net/forecast/YOUR-API-KEY/' + latitude + ',' + longitude + '?units=us',
//current conditions api from Darksky.net and variables for printing inside app.

dataType: "jsonp",
success: function(data) {
$.ajax({
url: 'https://api.darksky.net/forecast/YOUR-API-KEY/' + latitude + ',' + longitude + '?units=us',

dataType: "jsonp",
success: function(data) {

var temp = data.currently.temperature;
var description = data.currently.summary;
var hourlyDescription = data.hourly.summary;
var celsius = Math.round((temp - 32) * (5 / 9));
var tempFeel = data.currently.apparentTemperature;
var tempFeelCelsius = Math.round((tempFeel - 32) * (5 / 9));
var forecast = data.daily.summary;

if (data.hasOwnProperty("alerts")) {
var severe = data.alerts;
var severeAlert = data.alerts[0].title;
window.severe = severe;
alert(severeAlert);
}
var temp = data.currently.temperature;
var description = data.currently.summary;
var hourlyDescription = data.hourly.summary;
var celsius = Math.round((temp - 32) * (5 / 9));
var tempFeel = data.currently.apparentTemperature;
var tempFeelCelsius = Math.round((tempFeel - 32) * (5 / 9));
var forecast = data.daily.summary;

if (data.hasOwnProperty("alerts")) {
var severe = data.alerts;
var severeAlert = data.alerts[0].title;
window.severe = severe;
alert(severeAlert);
}

window.temp = temp;
window.description = description;
window.celsius = celsius;
window.tempFeel = tempFeel;
window.tempFeelCelsius = tempFeelCelsius;

window.temp = temp;
window.description = description;
window.celsius = celsius;
window.tempFeel = tempFeel;
window.tempFeelCelsius = tempFeelCelsius;

console.log(data);

var current = document.getElementById(conditions);
var dataPoints = document.getElementById(variables);
console.log(data);

conditions.innerHTML = "<p>It is currently " + Math.round(temp) + " °F" + " and " + description;
var current = document.getElementById(conditions);
var dataPoints = document.getElementById(variables);

if (temp != tempFeel) {
variables.innerHTML = "<p> It feels like it is " + Math.round(tempFeel) + " °F.";
conditions.innerHTML = "<p>It is currently " + Math.round(temp) + " °F" + " and " + description;

}
if (temp != tempFeel) {
variables.innerHTML = "<p> It feels like it is " + Math.round(tempFeel) + " °F.";

}


var hourly = document.getElementById(twentyfour);

twentyfour.innerHTML = "<p> Expect " + hourlyDescription;
var hourly = document.getElementById(twentyfour);

var weatherIcon = document.getElementById(weathercon);
twentyfour.innerHTML = "<p> Expect " + hourlyDescription;

// switch to generate weather icon based on current conditions
var icon = data.currently.icon;
var weatherIcon = document.getElementById(weathercon);

switch (icon) {
case 'clear-night':
case 'clear-day':
return weathercon.innerHTML = '<div class="sun"><div class=rays></div></div>';
// switch to generate weather icon based on current conditions
var icon = data.currently.icon;

case 'rain':
return weathercon.innerHTML = '<div class="cloud"><div class="rain"></div></div>';
switch (icon) {
case 'clear-night':
case 'clear-day':
return weathercon.innerHTML = '<div class="sun"><div class=rays></div></div>';

case 'thunderstorm':
case 'hail':
return weathercon.innerHTML = '<div class="cloud"><div class ="lightning"><div class="bolt"></div><div class="bolt"></div></div>';
case 'rain':
return weathercon.innerHTML = '<div class="cloud"><div class="rain"></div></div>';

case 'cloudy':
case 'fog':
case 'windy':
return weathercon.innerHTML = '<div class="cloud"></div><div class="cloud"></div>';
case 'thunderstorm':
case 'hail':
return weathercon.innerHTML = '<div class="cloud"><div class ="lightning"><div class="bolt"></div><div class="bolt"></div></div>';

case 'snow':
case 'sleet':
return weathercon.innerHTML = '<div class="cloud"><div class="snow"><div class="flake"></div><div class="flake"></div></div></div>';
case 'cloudy':
case 'fog':
case 'windy':
return weathercon.innerHTML = '<div class="cloud"></div><div class="cloud"></div>';

case 'partly-cloudy-day':
case 'partly-cloudy-night':
return weathercon.innerHTML = '<div class="cloud"></div><div class="sun"><div class="rays"></div></div>';
case 'snow':
case 'sleet':
return weathercon.innerHTML = '<div class="cloud"><div class="snow"><div class="flake"></div><div class="flake"></div></div></div>';

case 'tornado':
return weathercon.innerHTML = '<div class="cloud"><div class ="lightning"><div class="bolt"></div><div class="bolt"></div></div></div><div class="cloud"></div>';
case 'partly-cloudy-day':
case 'partly-cloudy-night':
return weathercon.innerHTML = '<div class="cloud"></div><div class="sun"><div class="rays"></div></div>';

case 'tornado':
return weathercon.innerHTML = '<div class="cloud"><div class ="lightning"><div class="bolt"></div><div class="bolt"></div></div></div><div class="cloud"></div>';

default:

}
}
});
default:

}
}
});

function error() {
output.innerHTML = "Unable to retrieve your location";
}
}

userAddress.innerHTML = "<p>Grabbing Your Location...</p>";
function error() {
output.innerHTML = "Unable to retrieve your location";
}

navigator.geolocation.getCurrentPosition(success, error);
userAddress.innerHTML = "<p>Grabbing Your Location...</p>";

}
navigator.geolocation.getCurrentPosition(success, error);

// Code to return the celsius converstion
function convertC() {

conditions.innerHTML = "<p> It is currently " + Math.round(celsius) + " °C" + " and " + description;

if (temp != tempFeel) {
variables.innerHTML = "<p> It feels like it is " + Math.round(tempFeelCelsius) + " °C.";
// Code to return the celsius converstion
function convertC() {

}
conditions.innerHTML = "<p> It is currently " + Math.round(celsius) + " °C" + " and " + description;

if (temp != tempFeel) {
variables.innerHTML = "<p> It feels like it is " + Math.round(tempFeelCelsius) + " °C.";

}

function convertF() {
}

conditions.innerHTML = "<p> It is currently " + Math.round(temp) + " °F" + " and " + description;
function convertF() {

if (temp != tempFeel) {
variables.innerHTML = "<p> It feels like it is " + Math.round(tempFeel) + " °F.";
conditions.innerHTML = "<p> It is currently " + Math.round(temp) + " °F" + " and " + description;

}
if (temp != tempFeel) {
variables.innerHTML = "<p> It feels like it is " + Math.round(tempFeel) + " °F.";

}
}

}
}

0 comments on commit 960b449

Please sign in to comment.