document.addEventListener("DOMContentLoaded", function(){ const editorButtons = document.getElementsByClassName('editor-button'); const setAttribute = (element) => { document.execCommand(element.dataset.attribute, false); }; for(let i = 0; i { console.log(element); document.execCommand(element.dataset.attribute, false, element.value); }; const backColor = document.getElementById("backcolor"); const helo = document.getElementsByClassName("canvas"); backColor.addEventListener('change', function(){ console.log(this); for(let i = 0; i { btn.addEventListener("click", () => { const popup = document.querySelector(btn.dataset.popupTarget); openPopup(popup); }) }); closePopupBtns.forEach(btn => { btn.addEventListener("click", () => { const popup = btn.closest(".popup") closePopup(popup); }) }); function openPopup(popup) { if (popup == null) return popup.classList.add("active"); overlay.classList.add("active"); } function closePopup(popup) { if (popup == null) return popup.classList.remove("active"); overlay.classList.remove("active"); } document.getElementById("startDate").onchange = function(){ document.getElementById("endDate").min = document.getElementById("startDate").value; var end = new Date(document.getElementById("startDate").value); end.setDate(end.getDate() +7); var endDate = end.toISOString().slice(0,10); document.getElementById("endDate").value = endDate; } function date(){ var today = new Date().toISOString().slice(0,10); var end = new Date(); end.setDate(end.getDate() + 7) var endDate = end.toISOString().slice(0,10); document.getElementById("startDate").value = today; document.getElementById("startDate").min = today; document.getElementById("endDate").value = endDate; document.getElementById("endDate").min = today; }; date() });