v59: асинхронная загрузка data.json, убран sync XHR

This commit is contained in:
Dauren777 2026-06-09 12:06:03 +00:00
parent 7a78473977
commit e5bdb47505

View File

@ -111,9 +111,15 @@ function gsc(id){var r=localStorage.getItem("ss_"+id);return r?JSON.parse(r):[]}
function ssc(id,a){localStorage.setItem("ss_"+id,JSON.stringify(a))}
var ev=null;
function le(){var s=localStorage.getItem("se2");if(s){try{ev=JSON.parse(s);return}catch(e){}}ld()}
function le(){var s=localStorage.getItem("se2");if(s){try{ev=JSON.parse(s);return}catch(e){}}ev=[];se()}
function se(){localStorage.setItem("se2",JSON.stringify(ev||[]))}
function ld(){var x=new XMLHttpRequest();x.open("GET","data.json",false);try{x.send();if(x.status===200)ev=JSON.parse(x.responseText);else ev=[]}catch(e){ev=[]};se()}
function ld(){
var x=new XMLHttpRequest();
x.open("GET","data.json",true);
x.onload=function(){if(x.status===200){try{ev=JSON.parse(x.responseText);se()}catch(e){}};if(ev&&ev.length&&cu)switchPg("ev")};
x.onerror=function(){};
x.send();
}
function doLogin(){var e=document.getElementById("lem").value.trim().toLowerCase();if(U[e]){cu={em:e,n:U[e].n,b:U[e].b,r:U[e].r};localStorage.setItem("su",JSON.stringify(cu));show()}else document.getElementById("lerr").style.display="block"}
function doLogout(){localStorage.removeItem("su");cu=null;document.getElementById("login").style.display="flex";document.getElementById("app").style.display="none"}
@ -288,7 +294,7 @@ document.getElementById("mo").addEventListener("click",function(e){if(e.target==
document.addEventListener("keydown",function(e){if(e.key==="Escape")closeM()});
document.addEventListener("click",function(e){if(!e.target.closest(".notif-btn")&&!e.target.closest(".notif-drop"))document.getElementById("nd").classList.remove("on")});
le();var su=localStorage.getItem("su");if(su){try{cu=JSON.parse(su);if(cu)show()}catch(e){}}
le();ld();var su=localStorage.getItem("su");if(su){try{cu=JSON.parse(su);if(cu)show()}catch(e){}}
</script>
</body>
</html>