2024-01-23 04:30:23 -08:00
|
|
|
function setFormStateCookie(value) {
|
|
|
|
const thirtyDays = 60 * 60 * 24 * 30;
|
2024-01-23 04:40:05 -08:00
|
|
|
document.cookie = `DTIItemPageUserListsFormState=${value};max-age=${thirtyDays}`;
|
2024-01-23 04:30:23 -08:00
|
|
|
}
|
|
|
|
|
2024-03-13 21:26:22 -07:00
|
|
|
document.addEventListener("click", (event) => {
|
|
|
|
if (event.target.matches(".item-header .user-lists-form-opener")) {
|
|
|
|
const header = event.target.closest(".item-header");
|
2024-01-23 04:20:03 -08:00
|
|
|
const form = header.querySelector(".user-lists-form");
|
2024-03-13 21:26:22 -07:00
|
|
|
if (form.hasAttribute("hidden")) {
|
|
|
|
form.removeAttribute("hidden");
|
|
|
|
setFormStateCookie("open");
|
|
|
|
} else {
|
|
|
|
form.setAttribute("hidden", "");
|
|
|
|
setFormStateCookie("closed");
|
|
|
|
}
|
|
|
|
event.preventDefault();
|
2024-01-21 06:20:32 -08:00
|
|
|
}
|
2024-03-13 21:26:22 -07:00
|
|
|
});
|