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
44 lines
1.6 KiB
JavaScript
44 lines
1.6 KiB
JavaScript
/* 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);
|
||
});
|