diff --git a/www/assets/images/weather-clear.svg b/www/assets/images/weather-clear.svg
index e6bd87e..4f4b6e1 100644
--- a/www/assets/images/weather-clear.svg
+++ b/www/assets/images/weather-clear.svg
@@ -26,7 +26,7 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
- inkscape:cx="-222.82058"
+ inkscape:cx="-432.10629"
inkscape:cy="388.57143"
inkscape:document-units="px"
inkscape:current-layer="layer1"
@@ -57,19 +57,20 @@
+ transform="matrix(0.15119047,0,0,0.15119047,33.866667,216.0375)"
+ style="fill:#8d6e63">
+ style="opacity:0.4;fill:#8d6e63;fill-opacity:1" />
+ style="fill:#8d6e63;fill-opacity:1" />
+
+
+
diff --git a/www/assets/images/weather-none.svg b/www/assets/images/weather-none.svg
new file mode 100644
index 0000000..70be771
--- /dev/null
+++ b/www/assets/images/weather-none.svg
@@ -0,0 +1,76 @@
+
+
+
+
diff --git a/www/assets/images/weather-partly-cloudy.svg b/www/assets/images/weather-partly-cloudy.svg
new file mode 100644
index 0000000..8e262a8
--- /dev/null
+++ b/www/assets/images/weather-partly-cloudy.svg
@@ -0,0 +1,106 @@
+
+
+
+
diff --git a/www/assets/images/weather-rain.svg b/www/assets/images/weather-rain.svg
index 438b8b2..b4513c3 100644
--- a/www/assets/images/weather-rain.svg
+++ b/www/assets/images/weather-rain.svg
@@ -26,7 +26,7 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
- inkscape:cx="-597.85715"
+ inkscape:cx="-807.14286"
inkscape:cy="388.57143"
inkscape:document-units="px"
inkscape:current-layer="layer1"
@@ -57,19 +57,20 @@
+ transform="matrix(0.15119047,0,0,0.15119047,33.866668,216.0375)"
+ style="fill:#8d6e63">
+ style="opacity:0.4;fill:#8d6e63;fill-opacity:1" />
+ style="fill:#8d6e63;fill-opacity:1" />
+ transform="matrix(0.15119047,0,0,0.15119047,33.866668,216.0375)"
+ style="fill:#8d6e63">
+ style="opacity:0.4;fill:#8d6e63;fill-opacity:1" />
+ style="fill:#8d6e63;fill-opacity:1" />
+
+
+
+
+ transform="matrix(0.12285727,0.0329195,-0.0329195,0.12285727,73.213132,204.86962)"
+ style="fill:#8d6e63">
+ style="opacity:0.4;fill:#8d6e63;fill-opacity:1" />
+ style="fill:#8d6e63;fill-opacity:1" />
-
diff --git a/www/assets/js/toolbox_weather.js b/www/assets/js/toolbox_weather.js
index 4eb59c7..2c23bb3 100644
--- a/www/assets/js/toolbox_weather.js
+++ b/www/assets/js/toolbox_weather.js
@@ -9,7 +9,12 @@ function ftoc(f) {
return (f - 32) * 5 / 9;
}
-function loadWeather() {
+function loadWeather(reload) {
+ if (typeof reload == "undefined") {
+ reload = false;
+ } else {
+ reload = reload == true;
+ }
if (userPosition.coords.accuracy > 99999) {
app.dialog.alert("Couldn't find your location. Wait for a GPS signal and try again.", "Error");
@@ -22,8 +27,10 @@ function loadWeather() {
url: SETTINGS.weatherapi,
dataType: 'json',
data: {
- latitude: userPosition.coords.latitude,
- longitude: userPosition.coords.longitude
+ // Round the numbers off to increase user privacy
+ // Accuracy with two decimal places is ~1.1km/0.6mi
+ latitude: userPosition.coords.latitude.toFixed(2),
+ longitude: userPosition.coords.longitude.toFixed(2)
},
timeout: 15 * 1000,
success: function (resp) {
@@ -38,7 +45,12 @@ function loadWeather() {
$("#lowtemp").html(mintemp);
$("#hightemp").html(maxtemp);
$("#precipchance").text(Math.round(resp.precipitation.chance * 100.0) + "% chance");
- $("#weathericon").attr("src", "assets/images/weather-" + resp.icon + ".svg");
+ if (SETTINGS.weathericons.includes(resp.icon)) {
+ $("#weathericon").attr("src", "assets/images/weather-" + resp.icon + ".svg");
+ } else {
+ $("#weathericon").attr("src", "assets/images/weather-none.svg");
+ }
+ $("#forecast-info").text("Forecast covers the next " + resp.forecast_hours + " hours.");
} else {
app.dialog.alert(resp.message, "Error");
}
@@ -53,11 +65,16 @@ function loadWeather() {
}
});
- // Open a loading message if there's a delay
- setTimeout(function () {
- if (!requestfinished) {
- app.dialog.preloader("Checking Weather...");
- weatherdialogopen = true;
- }
- }, 1000);
+ // Open a loading message if there's a delay or we're reloading
+ if (reload) {
+ app.dialog.preloader("Checking Weather...");
+ weatherdialogopen = true;
+ } else {
+ setTimeout(function () {
+ if (!requestfinished) {
+ app.dialog.preloader("Checking Weather...");
+ weatherdialogopen = true;
+ }
+ }, 1000);
+ }
}
\ No newline at end of file
diff --git a/www/pages/toolbox/weather.html b/www/pages/toolbox/weather.html
index 3ee8165..197f3fa 100644
--- a/www/pages/toolbox/weather.html
+++ b/www/pages/toolbox/weather.html
@@ -14,7 +14,7 @@
Weather
@@ -24,7 +24,7 @@
-

+
-
+
diff --git a/www/settings.js b/www/settings.js
index 69f1674..076bf8c 100644
--- a/www/settings.js
+++ b/www/settings.js
@@ -78,6 +78,15 @@ var SETTINGS = {
pluralmapicon: "multiple-items"
}
},
+ weathericons: [
+ "clear",
+ "cloudy",
+ "partly-cloudy",
+ "rain",
+ "snow",
+ "windy",
+ "none"
+ ],
geocodeapi: "https://apis.netsyms.net/packagehelper/geocode.php",
trackingapi: "https://apis.netsyms.net/packagehelper/track.php",
weatherapi: "https://apis.netsyms.net/packagehelper/weather.php",