Files
Journal/static/js/main.js
SimolZimol 428dccc5b0 modified: app.py
modified:   db.py
	modified:   routes/journal_routes.py
	modified:   static/css/style.css
	modified:   static/js/main.js
	modified:   templates/base.html
	modified:   templates/day.html
	modified:   templates/future.html
	modified:   templates/index.html
	new file:   templates/monat.html
	modified:   templates/week.html
2026-08-02 21:12:17 +02:00

44 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* Bullet Journal kleine Frontend-Helfer */
document.addEventListener("DOMContentLoaded", function () {
// Tag-Ansicht: Datums-Eingabe synchronisiert verstecktes Feld + aktiviert Button
document.querySelectorAll(".move-ctrl").forEach(function (ctrl) {
var dateInput = ctrl.querySelector(".move-date");
var hidden = ctrl.querySelector("input[name='target_date']");
var btn = ctrl.querySelector("button[name='target'][value='date']");
function update() {
if (hidden && btn) {
hidden.value = dateInput ? dateInput.value : "";
btn.disabled = !dateInput || !dateInput.value;
}
}
if (dateInput) {
dateInput.addEventListener("change", update);
update();
}
});
// Wochen-/Monatsansicht: klassisches move-form-Datum
document.querySelectorAll(".move-form").forEach(function (form) {
var dateInput = form.querySelector("input[name='target_date']");
var dateBtn = form.querySelector("button[name='target'][value='date']");
function updateBtn() {
if (dateBtn) {
dateBtn.disabled = !dateInput || !dateInput.value;
}
}
if (dateInput) {
dateInput.addEventListener("change", updateBtn);
updateBtn();
}
});
// Flash-Nachrichten automatisch ausblenden
setTimeout(function () {
document.querySelectorAll(".flash").forEach(function (el) {
el.style.transition = "opacity .4s";
el.style.opacity = "0";
setTimeout(function () { el.remove(); }, 400);
});
}, 5000);
});