Исправлено переключение Безопасно/Опасно

This commit is contained in:
Dauren777 2026-06-04 09:46:43 +00:00
parent 1c6c7e8d17
commit b744974674

View File

@ -33,7 +33,7 @@ body{font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,system-ui,s
.hg .fg label{font-size:11px;font-weight:700;color:var(--g5);display:block;margin-bottom:3px;text-transform:uppercase}
.hg .fg input,.hg .fg select{width:100%;padding:8px 10px;border:2px solid var(--g2);border-radius:var(--r);font-size:13px;font-family:inherit;outline:none;background:var(--white)}.hg .fg input:focus,.hg .fg select:focus{border-color:var(--cyan)}
.ot{display:flex;gap:12px;margin-top:12px}.tb{flex:1;padding:10px;border:2px solid var(--g2);border-radius:var(--r);text-align:center;cursor:pointer;font-size:13px;font-weight:700;background:var(--white);transition:all .2s}
.tb.sel{border-color:var(--green);background:#EDF7F0;color:var(--green)}.tb.dng.sel{border-color:var(--red);background:#FFEBED;color:var(--red)}
.tb.sel{border-color:var(--green);background:#EDF7F0;color:var(--green)}.tb.dng.sel{border-color:var(--red);background:#FFEBED;color:var(--red)}.tb.dng{color:#5B6573}
.cs{background:var(--white);border-radius:var(--rl);box-shadow:var(--sh);margin-bottom:12px;overflow:hidden}
.ch{display:flex;align-items:center;justify-content:space-between;padding:14px 20px;background:var(--g1);cursor:pointer;user-select:none}
.ch .ct{font-size:15px;font-weight:700}
@ -132,7 +132,7 @@ var vioHTML="";for(var i=0;i<vrc;i++)vioHTML+=mkV(i+1);document.getElementById("
document.getElementById("vr").onclick=function(e){if(e.target.classList.contains("rvb")){var n=parseInt(e.target.getAttribute("data-row"));removeVR(n)}};
document.getElementById("d4").onchange=function(){var o=document.getElementById("do");o.style.display=this.checked?"block":"none";o.classList.toggle("vs",this.checked)};
function setO(t){document.getElementById("os").classList.toggle("sel",t==="safe");document.getElementById("od").classList.toggle("sel",t==="danger")}
function setO(t){var os=document.getElementById("os"),od=document.getElementById("od");if(!os||!od)return;if(t==="safe"){os.classList.add("sel");od.classList.remove("sel")}else{os.classList.remove("sel");od.classList.add("sel")}}
function toggleAllSafe(id){var cb=document.getElementById("ascb-"+id),tog=document.getElementById("as-"+id);if(!cb||!tog)return;var is=!cb.checked;cb.checked=is;if(is){tog.classList.add("ac2");var cat=CATS.find(function(c){return c.id===id});if(cat)cat.items.forEach(function(_,i){var e=document.getElementById("cb-"+id+"-"+i);if(e){e.checked=false;e.parentElement.classList.remove("ck")}var o=document.getElementById("other-"+id);if(o){o.style.display="none";o.classList.remove("vs")}})}else{tog.classList.remove("ac2")}updateCatTotal(id)}
function onCheckItem(id,idx){var cb=document.getElementById("cb-"+id+"-"+idx);if(!cb)return;if(cb.checked){cb.parentElement.classList.add("ck");document.getElementById("ascb-"+id).checked=false;document.getElementById("as-"+id).classList.remove("ac2")}else{cb.parentElement.classList.remove("ck")}var cat=CATS.find(function(c){return c.id===id});if(cat&&cat.items[idx]==="Другое"){var o=document.getElementById("other-"+id);if(o){if(cb.checked){o.style.display="block";o.classList.add("vs")}else{o.style.display="none";o.classList.remove("vs")}}}updateCatTotal(id)}
function updateCatTotal(id){var cat=CATS.find(function(c){return c.id===id});if(!cat)return;var cnt=0;cat.items.forEach(function(_,i){if(document.getElementById("cb-"+id+"-"+i)&&document.getElementById("cb-"+id+"-"+i).checked)cnt++});var te=document.getElementById("total-"+id);if(te){te.textContent=cnt;if(cnt===0)te.classList.add("zr");else te.classList.remove("zr")}var b=document.getElementById("badge-"+id);if(b){if(cnt===0){b.textContent="ВСЕ БЕЗОПАСНО";b.classList.add("as")}else{b.textContent="Нарушений: "+cnt;b.classList.remove("as")}}}