Add weather info to GPS popup, bind to weather icon,

fix recurring console error message
master
Skylar Ittner 8 years ago
parent 39c61ae670
commit 30a04f1519

@ -27,7 +27,7 @@
<meta name="author" content=""> <meta name="author" content="">
<!-- https://forums.adobe.com/thread/2167432 --> <!-- https://forums.adobe.com/thread/2167432 -->
<meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; style-src 'self' 'unsafe-inline' *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *"> <meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file: data:; style-src 'self' 'unsafe-inline' *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *">
<title>TerranQuest</title> <title>TerranQuest</title>

@ -70,7 +70,7 @@ var placeLayer = L.geoJson(
}); });
} }
});//.addTo(map); });//.addTo(map);
var placemarkers = L.markerClusterGroup({ var placemarkers = L.markerClusterGroup({
spiderfyDistanceMultiplier: 2, spiderfyDistanceMultiplier: 2,
showCoverageOnHover: false, showCoverageOnHover: false,
@ -226,18 +226,16 @@ function onError(error) {
$('#loading-error').text("Check your device's network and location settings, and ensure a clear view of the sky."); $('#loading-error').text("Check your device's network and location settings, and ensure a clear view of the sky.");
} }
function popGPS() { function popDiagData() {
navigator.notification.alert("Latitude: " + latitude + navigator.notification.alert("Latitude: " + latitude +
"\nLongitude: " + longitude + "\nLongitude: " + longitude +
"\nAccuracy: " + gpsaccuracy + "\nAccuracy: " + gpsaccuracy +
"\nWeather: " + rawWeatherData.temperature + " F, " + rawWeatherData.summary + ", " + rawWeatherData.windSpeed + " mph" +
"\nTerrain: " + terraintypename + " (" + terraintypeid + ")", "\nTerrain: " + terraintypename + " (" + terraintypeid + ")",
null, null,
"GPS Information", "Information",
"Close"); "Close");
} }
$('#terrain-image').click(function () {
popGPS();
});
// Initial GPS position and stuff // Initial GPS position and stuff
navigator.geolocation.getCurrentPosition(updateTerrain, onError, {timeout: 10000, enableHighAccuracy: true}); navigator.geolocation.getCurrentPosition(updateTerrain, onError, {timeout: 10000, enableHighAccuracy: true});
// Update position // Update position

@ -20,6 +20,7 @@
// Profile, stats, and chat stuff // Profile, stats, and chat stuff
////////////////////////////////////////////// //////////////////////////////////////////////
var rawWeatherData = [];
/* /*
* Handles general server communication. * Handles general server communication.
@ -79,6 +80,7 @@ function getWeather() {
long: longitude long: longitude
}, function (data) { }, function (data) {
var currently = data.currently; var currently = data.currently;
rawWeatherData = currently;
skycons.set("weathericon", currently.icon); skycons.set("weathericon", currently.icon);
}); });
} }

@ -43,7 +43,7 @@
<div id="overlay-top"> <div id="overlay-top">
<p id="topbar"> <p id="topbar">
<span id="namedisp" onclick="openMenu('profile')"></span> <span id="namedisp" onclick="openMenu('profile')"></span>
<span id="worldinfo"><canvas id="weathericon" width="22" height="22"></canvas></span> <span id="worldinfo" onclick="popDiagData()"><canvas id="weathericon" width="22" height="22"></canvas></span>
</p> </p>
<div class="progress" id="energybar-container"> <div class="progress" id="energybar-container">
<div id="energybar" class="progress-bar" role="progressbar" > <div id="energybar" class="progress-bar" role="progressbar" >