Added Util.close to allow interfaces to close the window
Fix My Location that couldn't be installed after the most recent updatemaster
parent
adcee06813
commit
f4a48e62e6
|
|
@ -6,3 +6,4 @@
|
||||||
0.06: renamed source files to match standard
|
0.06: renamed source files to match standard
|
||||||
0.07: Move mylocation app into 'Settings -> Apps'
|
0.07: Move mylocation app into 'Settings -> Apps'
|
||||||
0.08: Allow setting location from webinterface in the AppLoader
|
0.08: Allow setting location from webinterface in the AppLoader
|
||||||
|
0.09: Fix web interface so app can be installed (replaced custom with interface html)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,12 @@
|
||||||
|
|
||||||
*Sets and stores GPS lat and lon of your preferred city*
|
*Sets and stores GPS lat and lon of your preferred city*
|
||||||
|
|
||||||
To access, go to `Settings -> Apps -> My Location`
|
To access, you have two options:
|
||||||
|
|
||||||
|
**In the App Loader** once My Location is installed, click on the 'Save' icon
|
||||||
|
next to it - and you can choose your location on a map.
|
||||||
|
|
||||||
|
**On Bangle.js** go to `Settings -> Apps -> My Location`
|
||||||
|
|
||||||
* Select one of the preset Cities, setup through the GPS or use the webinterface from the AppLoader
|
* Select one of the preset Cities, setup through the GPS or use the webinterface from the AppLoader
|
||||||
* Other Apps can read this information to do calculations based on location
|
* Other Apps can read this information to do calculations based on location
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,11 @@
|
||||||
<div id="map">
|
<div id="map">
|
||||||
</div>
|
</div>
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
|
<span id="select-hint">Click the map to select a location</span>
|
||||||
<button id="select" class="btn btn-primary" style="display:none">Save</button><br/>
|
<button id="select" class="btn btn-primary" style="display:none">Save</button><br/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../../core/lib/customize.js"></script>
|
<script src="../../core/lib/interface.js"></script>
|
||||||
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
|
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
|
||||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||||
<script src="../../webtools/heatshrink.js"></script>
|
<script src="../../webtools/heatshrink.js"></script>
|
||||||
|
|
@ -69,14 +70,18 @@
|
||||||
let latlon;
|
let latlon;
|
||||||
var marker;
|
var marker;
|
||||||
|
|
||||||
map.on('click', function(e){
|
function setPosition(ll) {
|
||||||
console.log(e);
|
latlon = ll;
|
||||||
if (map.hasLayer(marker)) {
|
if (map.hasLayer(marker)) {
|
||||||
map.removeLayer(marker);
|
map.removeLayer(marker);
|
||||||
}
|
}
|
||||||
latlon = e.latlng;
|
marker = new L.marker(latlon).addTo(map);
|
||||||
marker = new L.marker(e.latlng).addTo(map);
|
document.getElementById("select-hint").style.display="none";
|
||||||
document.getElementById("select").style.display="";
|
document.getElementById("select").style.display="";
|
||||||
|
}
|
||||||
|
|
||||||
|
map.on('click', function(e){
|
||||||
|
setPosition(e.latlng);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("select").addEventListener("click", function() {
|
document.getElementById("select").addEventListener("click", function() {
|
||||||
|
|
@ -87,9 +92,23 @@
|
||||||
Util.showModal("Saving...");
|
Util.showModal("Saving...");
|
||||||
Util.writeStorage("mylocation.json", JSON.stringify(settings), ()=>{
|
Util.writeStorage("mylocation.json", JSON.stringify(settings), ()=>{
|
||||||
Util.hideModal();
|
Util.hideModal();
|
||||||
|
Util.close(); // close this window
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function onInit() {
|
||||||
|
// read existing location
|
||||||
|
Util.readStorage("mylocation.json", function(data) {
|
||||||
|
if (data===undefined) return; // no file
|
||||||
|
try {
|
||||||
|
var j = JSON.parse(data);
|
||||||
|
setPosition(j);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -4,12 +4,12 @@
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type": "settings",
|
"type": "settings",
|
||||||
"screenshots": [{"url":"screenshot_1.png"}],
|
"screenshots": [{"url":"screenshot_1.png"}],
|
||||||
"version":"0.08",
|
"version":"0.09",
|
||||||
"description": "Sets and stores the latitude and longitude of your preferred City. It can be set from GPS or webinterface. `mylocation.json` can be used by other apps that need your main location. See README for details.",
|
"description": "Sets and stores the latitude and longitude of your preferred City. It can be set from GPS or webinterface. `mylocation.json` can be used by other apps that need your main location. See README for details.",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"tags": "tool,utility",
|
"tags": "tool,utility",
|
||||||
"supports": ["BANGLEJS", "BANGLEJS2"],
|
"supports": ["BANGLEJS", "BANGLEJS2"],
|
||||||
"custom": "custom.html","custom": "custom.html",
|
"interface": "interface.html",
|
||||||
"storage": [
|
"storage": [
|
||||||
{"name":"mylocation.settings.js","url":"settings.js"}
|
{"name":"mylocation.settings.js","url":"settings.js"}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
2
core
2
core
|
|
@ -1 +1 @@
|
||||||
Subproject commit db08367e0a2c25040449a4b556eaed459e8f47fc
|
Subproject commit aba9b6a51fe02dfbde307c303560b8382857916d
|
||||||
Loading…
Reference in New Issue