diff --git a/index.html b/index.html index 3a3d12f..b7eba18 100644 --- a/index.html +++ b/index.html @@ -80,6 +80,8 @@

Simple Weather Overlay

+ + diff --git a/js/GeoPosition.js b/js/GeoPosition.js index d3d3392..fbd8912 100644 --- a/js/GeoPosition.js +++ b/js/GeoPosition.js @@ -4,6 +4,8 @@ function ShowPositionValues(position){ console.log("long: " + pos.longitude); $(".place_field").attr("disabled", true); $("#city_input").val("Using geolocation info"); + $("#lat_field").val(pos.latitude); + $("#lon_field").val(pos.longitude); } function GetPosition(){ diff --git a/js/OpenWeather.js b/js/OpenWeather.js index 693513a..6b051a1 100644 --- a/js/OpenWeather.js +++ b/js/OpenWeather.js @@ -19,7 +19,7 @@ $(document).ready(function(){ $(".WeatherInfo").addClass("Light"); } var place = ""; - if (parameters.get("country") !== "") { + if (parameters.get("country")) { place = parameters.get("city") + "," + parameters.get("country").toLowerCase(); } else { @@ -41,15 +41,15 @@ $(document).ready(function(){ var tempMin; var tempMax; var midday = GetMidday(); - if (parameters.lat != null){ - placeCoordinates.lat = parameters.lat; - placeCoordinates.lon = parameters.lon; + if (parameters.get("lat")){ + placeCoordinates.lat = parameters.get("lat"); + placeCoordinates.lon = parameters.get("lon"); } function PlaceData() { let params = {}; - if (placeCoordinates.lat != null){ + if (placeCoordinates.lat){ params = { "lat": placeCoordinates.lat, "lon": placeCoordinates.lon, diff --git a/js/main.js b/js/main.js index 7cfec4a..f7e9eac 100644 --- a/js/main.js +++ b/js/main.js @@ -9,6 +9,7 @@ $(document).ready( function() { $("#country-list").append($("")); } }); + $.ajax({ url: "https://gist.githubusercontent.com/jvicu2001/666fc491228453a8f1981167bb6c8912/raw/24b3e3155a0b9f398b629c7f907f2cbc52d36766/openweather_languages.json", type: "GET", @@ -19,6 +20,9 @@ $(document).ready( function() { $("#language-list").append($("")); } }); + if ($("#city_input").val() == "Using geolocation info"){ + $("#city_input").val(""); + } } ); function makeURL() { var params = $( "form" ).serialize();