fix: switchEvMonthBtn saves to CURRENT month before switching to new

This commit is contained in:
Dauren777 2026-06-12 03:35:13 +00:00
parent cb8290a2ee
commit 576e54c592

View File

@ -1214,7 +1214,7 @@ function closeModal(){
document.getElementById("modal").style.display="none" document.getElementById("modal").style.display="none"
} }
function switchEvMonthBtn(id,m,subIdx){var inn=document.getElementById("evn_"+id);var subSuffix=curSub!==null?"_s"+curSub:"";if(inn)try{localStorage.setItem("sn_"+id+subSuffix+"_m"+m,inn.value.trim())}catch(e){}try{localStorage.setItem("evmonth_"+id,m.toString())}catch(e){}openEv(id,subIdx!==null?subIdx:undefined)} function switchEvMonthBtn(id,m,subIdx){var inn=document.getElementById("evn_"+id);var curM=localStorage.getItem("evmonth_"+id)||"0";var subSuffix=curSub!==null?"_s"+curSub:"";if(inn)try{localStorage.setItem("sn_"+id+subSuffix+"_m"+curM,inn.value.trim())}catch(e){}try{localStorage.setItem("evmonth_"+id,m.toString())}catch(e){}openEv(id,subIdx!==null?subIdx:undefined)}
function switchEvMonth(id,subIdx){var inm=document.getElementById("evm_"+id);if(!inm)return;var mv=inm.value;var inn=document.getElementById("evn_"+id);var subSuffix=curSub!==null?"_s"+curSub:"";if(inn)try{localStorage.setItem("sn_"+id+subSuffix+"_m"+mv,inn.value.trim())}catch(e){}try{localStorage.setItem("evmonth_"+id,mv)}catch(e){}openEv(id,subIdx!==null?subIdx:undefined)} function switchEvMonth(id,subIdx){var inm=document.getElementById("evm_"+id);if(!inm)return;var mv=inm.value;var inn=document.getElementById("evn_"+id);var subSuffix=curSub!==null?"_s"+curSub:"";if(inn)try{localStorage.setItem("sn_"+id+subSuffix+"_m"+mv,inn.value.trim())}catch(e){}try{localStorage.setItem("evmonth_"+id,mv)}catch(e){}openEv(id,subIdx!==null?subIdx:undefined)}
function saveEvModal(id){var sel=document.getElementById("evs_"+id);for(var i=0;i<evs.length;i++){if(evs[i].id===id){if(sel)evs[i].s=sel.value;if(sel&&sel.value==="done"&&(evs[i].done==="\u2014"||!evs[i].done)){var d=new Date();evs[i].done=d.getDate()+"."+String(d.getMonth()+1).padStart(2,"0")+"."+d.getFullYear()}break}}var inm=document.getElementById("evm_"+id);var mv=inm?inm.value:(localStorage.getItem("evmonth_"+id)||"0");if(mv!=null){try{localStorage.setItem("evmonth_"+id,mv)}catch(e){};var inn=document.getElementById("evn_"+id);var subSuffix2=curSub!==null?"_s"+curSub:"";if(inn)try{localStorage.setItem("sn_"+id+subSuffix2+"_m"+mv,inn.value.trim())}catch(e){}}saveEv();closeModal();renderEv()} function saveEvModal(id){var sel=document.getElementById("evs_"+id);for(var i=0;i<evs.length;i++){if(evs[i].id===id){if(sel)evs[i].s=sel.value;if(sel&&sel.value==="done"&&(evs[i].done==="\u2014"||!evs[i].done)){var d=new Date();evs[i].done=d.getDate()+"."+String(d.getMonth()+1).padStart(2,"0")+"."+d.getFullYear()}break}}var inm=document.getElementById("evm_"+id);var mv=inm?inm.value:(localStorage.getItem("evmonth_"+id)||"0");if(mv!=null){try{localStorage.setItem("evmonth_"+id,mv)}catch(e){};var inn=document.getElementById("evn_"+id);var subSuffix2=curSub!==null?"_s"+curSub:"";if(inn)try{localStorage.setItem("sn_"+id+subSuffix2+"_m"+mv,inn.value.trim())}catch(e){}}saveEv();closeModal();renderEv()}
function chgSt(id){ function chgSt(id){