diff --git a/www/assets/js/list.js b/www/assets/js/list.js index 2d0938d..5d117d5 100644 --- a/www/assets/js/list.js +++ b/www/assets/js/list.js @@ -10,11 +10,6 @@ $(".view-main").on("click", "#addresslist .package-list-item .deliver-btn", func loadPackageList(); }); -// Open geo: url -$(".view-main").on("click", "#addresslist .package-list-item .directions-btn", function () { - window.open($(this).attr("href"), "_system"); -}); - $(".view-main").on("click", "#addresslist .package-list-item .delete-btn", function () { var id = $(this).parents(".package-list-item").data("packageid"); console.log("Info", "Deleting package", id); @@ -133,37 +128,13 @@ function loadPackageList(sortType) { + '
' + '
' + ' ' + (delivered ? " Undeliver" : "  Deliver") + '' - + ' Directions' + + ' Directions' + ' Delete' + '
' + '
' + '' + '' ); -// $("#addresslist").append( -// '
  • ' -// + '
    ' -// + '
    ' -// + ' ' -// + '
    ' -// + '
    ' -// + '
    ' -// + ' ' + item.address -// + '
    ' -// + ' ' -// + '
    ' -// + '
    ' -// + '
    ' -// + ' ' + (delivered ? "  Undeliver" : "  Deliver") + '' -// + ' directions' -// + '
    ' -// + '
    ' -// + ' delete  Delete' -// + '
    ' -// + '
  • ' -// ); } } diff --git a/www/assets/js/platform.js b/www/assets/js/platform.js index 2e900d0..3ea13e4 100644 --- a/www/assets/js/platform.js +++ b/www/assets/js/platform.js @@ -170,6 +170,12 @@ function initCordova() { } else { setupHTML5BarcodeScanner(); } + + // Handle geo: urls + $("#app").on("click", ".geolink", function (evt) { + window.open($(this).attr("href"), "_system"); + evt.preventDefault(); + }); } function initNW() { @@ -209,6 +215,12 @@ function initNW() { setupHTML5BarcodeScanner(); + + // Handle geo: urls + $("#app").on("click", ".geolink", function (evt) { + require('nw.gui').Shell.openExternal($(this).attr("href")); + evt.preventDefault(); + }); } function initBrowser() { diff --git a/www/assets/js/toolbox_addresslookup.js b/www/assets/js/toolbox_addresslookup.js index 2b63564..de7efa5 100644 --- a/www/assets/js/toolbox_addresslookup.js +++ b/www/assets/js/toolbox_addresslookup.js @@ -1,4 +1,4 @@ -/* +/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -86,8 +86,8 @@ function addressLookup() { } if (resp.geocode.status == "OK") { $(".georesult").removeClass("display-none"); - $(".item-text #geocoords").text(resp.geocode.latitude + ", " + resp.geocode.longitude); - $(".item-text #geocoords").attr("src", "geo:" + resp.geocode.latitude + "," + resp.geocode.longitude); + $(".item-text #geocoords").text(resp.geocode.latitude.toFixed(4) + ", " + resp.geocode.longitude.toFixed(4)); + $(".item-text #geocoords").attr("href", "geo:" + resp.geocode.latitude.toFixed(4) + "," + resp.geocode.longitude.toFixed(4)); } else { $(".georesult").addClass("display-none"); } diff --git a/www/pages/toolbox/addrlookup.html b/www/pages/toolbox/addrlookup.html index 85e4f2e..02c57dc 100644 --- a/www/pages/toolbox/addrlookup.html +++ b/www/pages/toolbox/addrlookup.html @@ -104,7 +104,7 @@