diff --git a/www/assets/js/toolbox_scanner.js b/www/assets/js/toolbox_scanner.js index 8beb771..47a5b6a 100644 --- a/www/assets/js/toolbox_scanner.js +++ b/www/assets/js/toolbox_scanner.js @@ -209,7 +209,7 @@ $("#app").on("click", "ul li.eventtypebutton", function () { }); $("#brokenscannerinput").on('keypress', function (e) { - if (e.which == 13) { + if (event.key === "Enter") { brokenScannerAddTextEntry(); } }); \ No newline at end of file diff --git a/www/assets/js/toolbox_track.js b/www/assets/js/toolbox_track.js index fab59d3..1551736 100644 --- a/www/assets/js/toolbox_track.js +++ b/www/assets/js/toolbox_track.js @@ -86,7 +86,21 @@ function openTrackingHistory(code) { infocontext.history[i].date = timestampToDateTimeString(infocontext.history[i].date); infocontext.history[i].status = trackingStatusToNiceString(infocontext.history[i].status, true); } - // TODO: format timestamps as local time + + // Keep last five tracking codes in history + var history = localStorage.getItem("trackingcodehistory"); + if (history == null) { + history = []; + } else { + history = JSON.parse(history); + } + if (infocontext.code != "") { + history.push(infocontext.code); + } + while (history.length > 5) { + history.shift(); + } + localStorage.setItem("trackingcodehistory", JSON.stringify(history)); if (refresh) { router.navigate("/toolbox/track/info", { @@ -150,7 +164,7 @@ $("#trackbtn").click(function () { }); $("input[name=trackingcode]").on('keypress', function (e) { - if (e.which == 13) { + if (event.key === "Enter") { $("#trackbtn").click(); } }); \ No newline at end of file diff --git a/www/pages/toolbox/track.html b/www/pages/toolbox/track.html index de92ba9..c5bacb1 100644 --- a/www/pages/toolbox/track.html +++ b/www/pages/toolbox/track.html @@ -40,9 +40,32 @@ -