summaryrefslogtreecommitdiffstats
path: root/app/static/js/main.js
diff options
context:
space:
mode:
authorKen D'Ambrosio <ken@claude>2026-05-25 00:46:10 +0000
committerKen D'Ambrosio <ken@claude>2026-05-25 00:46:10 +0000
commit55bcec90c14db6f2956ed51cf4df1503c0767f81 (patch)
treef25bfb8c46366b5d3dc6b4f66e242c65094b4ada /app/static/js/main.js
Initial commit — menu.jots.org Flask/SQLite meal planner
Full-featured weekly menu planner with: - Recipe library with ratings, comments, cuisine/nationality, added-by attribution - AI recipe assistant (Claude) with URL fetching and file upload - Weekly meal plan grid with shopping list generation - Sort by name, prep/cook time, or rating - Print and copy-link support - Deployed on LXC container (192.168.10.51) behind Apache reverse proxy Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'app/static/js/main.js')
-rw-r--r--app/static/js/main.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/static/js/main.js b/app/static/js/main.js
new file mode 100644
index 0000000..ed1147b
--- /dev/null
+++ b/app/static/js/main.js
@@ -0,0 +1,18 @@
+// Global JSON fetch helper — redirects to /login on 401
+async function api(url, options = {}) {
+ const res = await fetch(url, {
+ headers: {'Content-Type': 'application/json'},
+ ...options,
+ });
+ if (res.status === 401) {
+ window.location.href = '/login?next=' + encodeURIComponent(window.location.pathname);
+ return null;
+ }
+ return res;
+}
+
+document.addEventListener('DOMContentLoaded', () => {
+ document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(el =>
+ new bootstrap.Tooltip(el)
+ );
+});