Add more timestamps and details.

This commit is contained in:
2021-07-05 16:55:48 +02:00
parent d02808926c
commit 30a5f72a35
4 changed files with 88 additions and 14 deletions
+31 -8
View File
@@ -1,16 +1,39 @@
var autoClose = true;
document.addEventListener("DOMContentLoaded", function(){
// Fetch all the details element.
const details = document.querySelectorAll("details");
// Add the onclick listeners.
details.forEach((targetDetail) => {
targetDetail.addEventListener("click", () => {
// Close all the details that are not targetDetail.
details.forEach((detail) => {
if (detail !== targetDetail) {
detail.removeAttribute("open");
}
targetDetail.addEventListener("click", () => {
// Close all the details that are not targetDetail.
if (autoClose) {
details.forEach((detail) => {
if (detail !== targetDetail) {
detail.removeAttribute("open");
}
});
}
});
});
});
});
});
function editNote(id, title, description, deadline, category) {
document.getElementById("add_form_action").value = "edit";
document.getElementById("add_form_button").value = "Edit";
document.getElementById("todo_item_id").value = id.toString();
document.getElementById("todo_title").value = title;
document.getElementById("todo_description").value = description;
document.getElementById("todo_deadline").value = deadline;
document.getElementById("todo_category").value = category;
setTimeout(
function() {
document.getElementById("addFormSummary").click();
},
5);
// document.getElementById("addFormSummary").click();
}