Sha256: 409020d7ca9230c996829ab7bacbb34eec8f506786e800ad6b1b5ea7d3aa27c0
Contents?: true
Size: 939 Bytes
Versions: 46
Compression:
Stored size: 939 Bytes
Contents
// Handles the page publication date fields export default function () { document.addEventListener("DialogReady.Alchemy", function (evt) { const dialog = evt.detail.body const public_on_field = dialog.querySelector("#page_public_on") const public_until_field = dialog.querySelector("#page_public_until") const publication_date_fields = dialog.querySelector( ".page-publication-date-fields" ) const public_field = dialog.querySelector("#page_public") if (!public_field) return public_field.addEventListener("click", function (evt) { const checkbox = evt.target const now = new Date() if (checkbox.checked) { publication_date_fields.classList.remove("hidden") public_on_field._flatpickr.setDate(now) } else { publication_date_fields.classList.add("hidden") public_on_field.value = "" } public_until_field.value = "" }) }) }
Version data entries
46 entries across 46 versions & 1 rubygems