Last active
September 15, 2021 16:04
-
-
Save truth3/48a5117310a5ce1bc7c41ced27e77d0d to your computer and use it in GitHub Desktop.
Revisions
-
truth3 revised this gist
Jul 14, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,6 +31,7 @@ var xmlHttp; if(xmlHttp != null) { xmlHttp.open( "GET", url, false ); xmlHttp.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:221.0) Gecko/20100101 Firefox/31.0"); xmlHttp.send( null ); resp = xmlHttp.responseText; } -
truth3 revised this gist
Oct 9, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ return allWeatherStr; function getCurrentConditions(lat, lng) { var url = "https://forecast.weather.gov/MapClick.php?lat=" + lat + "&lon=" + lng + "&FcstType=json"; var resp; var xmlHttp; -
truth3 created this gist
Jun 16, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ function getCurrentWeather(lat, lng) { var json = getCurrentConditions(lat, lng); var obj = JSON.parse(json); var currentWeather = obj.currentobservation.Weather; var tempF = obj.currentobservation.Temp; var currentWindSpeed = obj.currentobservation.Winds; var currentWindDirection = obj.currentobservation.Windd; var currentWindGust = obj.currentobservation.Gust; var currentHumidity = obj.currentobservation.Relh; var currentPressure = obj.currentobservation.SLP; var currentStation = obj.currentobservation.name; var currentStationElev = obj.currentobservation.elev; var currentWindChill = obj.currentobservation.WindChill; var forecastPeriod = obj.time.startPeriodName[0]; var forecastText = obj.data.text[0]; var allWeatherStr = (currentWeather + "||" + tempF + "||" + currentWindSpeed+ "||" + currentWindDirection+ "||" + currentWindGust+ "||" + currentHumidity+ "||" + currentPressure+ "||" + currentStation+ "||" + currentStationElev+ "||" + currentWindChill+ "||" + forecastPeriod+ "||" + forecastText); return allWeatherStr; } function getCurrentConditions(lat, lng) { var url = "http://forecast.weather.gov/MapClick.php?lat=" + lat + "&lon=" + lng + "&FcstType=json"; var resp; var xmlHttp; resp = "" ; xmlHttp = new XMLHttpRequest(); if(xmlHttp != null) { xmlHttp.open( "GET", url, false ); xmlHttp.send( null ); resp = xmlHttp.responseText; } return resp; }