diff --git a/www/assets/js/add.js b/www/assets/js/add.js index 79be7e7..79ec632 100644 --- a/www/assets/js/add.js +++ b/www/assets/js/add.js @@ -88,8 +88,12 @@ $(".view-main").on("click", "#historylist .history-list-item", function () { // Restore user's last entered city/state combo if (inStorage("citystate")) { - $("input[name=citystate]").val(getStorage("citystate")); + $("input[name=citystate]").val(getStorage("citystate").replace(/\s*[0-9]{5}$/, "")); } -if (inStorage("zipcode")) { +if (inStorage("zipcode") && getStorage("zipcode").trim() != "") { $("input[name=zipcode]").val(getStorage("zipcode")); +} else { + if (inStorage("citystate") && /^.+ [0-9]{5}$/.test(getStorage("citystate"))) { + $("input[name=zipcode]").val(getStorage("citystate").split(" ").pop()); + } } \ No newline at end of file diff --git a/www/pages/add.html b/www/pages/add.html index dcf5ee5..e8a1517 100644 --- a/www/pages/add.html +++ b/www/pages/add.html @@ -56,7 +56,7 @@
  • -
    +
    City, State
    @@ -65,8 +65,8 @@
    -
    -
    +
    +
    ZIP
    diff --git a/www/pages/home.html b/www/pages/home.html index 2149a34..00d9882 100644 --- a/www/pages/home.html +++ b/www/pages/home.html @@ -30,7 +30,7 @@