Period totals footer, category reorder, mobile fixes, PWA with update prompt
This commit is contained in:
65
index.html
65
index.html
@@ -7,7 +7,15 @@
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Petit+Formal+Script&family=Shadows+Into+Light+Two&family=Style+Script&family=Waterfall&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="styles.css?v=2">
|
||||
<link rel="stylesheet" href="styles.css?v=3">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<meta name="theme-color" content="#ff6fae">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
||||
<meta name="apple-mobile-web-app-title" content="Tally">
|
||||
<link rel="icon" href="icon-192.png">
|
||||
<link rel="apple-touch-icon" href="icon-192.png">
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar-mini">
|
||||
@@ -56,18 +64,13 @@
|
||||
<ul class="cats" id="catList"></ul>
|
||||
|
||||
<div class="side-foot">
|
||||
<label class="field compact">
|
||||
<span>Repeats</span>
|
||||
<select id="fFreqFilter" aria-label="Filter by repeat">
|
||||
<option value="all">All repeats</option>
|
||||
<option value="once">One-time</option>
|
||||
<option value="daily">Daily</option>
|
||||
<option value="weekly">Weekly</option>
|
||||
<option value="monthly">Monthly</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="period-pick" role="group" aria-label="Total for period">
|
||||
<button type="button" class="btn subtle small" data-period="day">Today</button>
|
||||
<button type="button" class="btn subtle small" data-period="week">Week</button>
|
||||
<button type="button" class="btn subtle small" data-period="month">Month</button>
|
||||
</div>
|
||||
<div class="month-total">
|
||||
<span>This month</span>
|
||||
<span id="periodLabel">This month</span>
|
||||
<strong id="sideMonth">$0.00</strong>
|
||||
</div>
|
||||
<div class="side-btns">
|
||||
@@ -164,6 +167,42 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="app.js?v=2"></script>
|
||||
<script src="app.js?v=3"></script>
|
||||
<button type="button" id="btnUpdate" class="update-pill" hidden>Update to latest version</button>
|
||||
<script>
|
||||
(function () {
|
||||
if (!("serviceWorker" in navigator)) return;
|
||||
var btn = document.getElementById("btnUpdate");
|
||||
function show() { btn.hidden = false; }
|
||||
btn.addEventListener("click", function () {
|
||||
btn.disabled = true;
|
||||
btn.textContent = "Updating…";
|
||||
if (navigator.serviceWorker.controller) {
|
||||
navigator.serviceWorker.getRegistration().then(function (reg) {
|
||||
if (reg && reg.waiting) reg.waiting.postMessage({ type: "SKIP_WAITING" });
|
||||
else location.reload();
|
||||
});
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
navigator.serviceWorker.addEventListener("controllerchange", function () { location.reload(); });
|
||||
window.addEventListener("load", function () {
|
||||
navigator.serviceWorker.register("sw.js", { updateViaCache: "none" }).then(function (reg) {
|
||||
if (reg.waiting) { show(); return; }
|
||||
reg.addEventListener("updatefound", function () {
|
||||
var w = reg.installing;
|
||||
if (!w) return;
|
||||
w.addEventListener("statechange", function () {
|
||||
if (w.state === "installed" && navigator.serviceWorker.controller) show();
|
||||
});
|
||||
});
|
||||
function check() { reg.update().catch(function () {}); }
|
||||
setInterval(check, 30 * 60 * 1000);
|
||||
document.addEventListener("visibilitychange", function () { if (!document.hidden) check(); });
|
||||
}).catch(function () { /* offline-first unavailable; the app still works */ });
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user