/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ var packages = []; if (localStorage.getItem("packages") != null) { packages = JSON.parse(localStorage.getItem("packages")); } function confirmDeletePackage(id) { app.dialog.confirm( "Delete package at " + packages[id].address + "?", "Confirm", function () { // delete packages.splice(id, 1); localStorage.setItem("packages", JSON.stringify(packages)); loadPackageList(); }, function () { // cancel } ); } function deletePackage(id) { packages.splice(id, 1); localStorage.setItem("packages", JSON.stringify(packages)); loadPackageList(); } function countRemainingPackages() { var undelivered = 0; for (var i = 0; i < packages.length; i++) { if (packages[i].delivered != true) { undelivered++; } } return undelivered; }