diff --git a/index.html b/index.html
index 3bbb5b8..9b193f6 100644
--- a/index.html
+++ b/index.html
@@ -975,14 +975,17 @@ function openDB(cb){
r.onsuccess=function(e){gdb=e.target.result;cb(gdb)};
r.onerror=function(){cb(null)}
}
-function idbPut(id,blob,name,size,type,cb){
- openDB(function(db){if(!db){cb(false);return}
- var tx=db.transaction("files","readwrite");var st=tx.objectStore("files");
- var fr=new FileReader();fr.onload=function(){
+function idbPut(id,file,name,size,type,cb){
+ var fr=new FileReader();
+ fr.onload=function(){
+ openDB(function(db){if(!db){cb(false);return}
+ var tx=db.transaction("files","readwrite");var st=tx.objectStore("files");
st.put({id:id,name:name,size:size,type:type,data:fr.result});
tx.oncomplete=function(){cb(true)};tx.onerror=function(){cb(false)}
- };fr.readAsArrayBuffer(new Blob([blob],{type:type||"application/octet-stream"}))
- })
+ })
+ };
+ fr.onerror=function(){cb(false)};
+ fr.readAsArrayBuffer(file)
}
function idbGetAll(prefix,cb){
openDB(function(db){if(!db){cb([]);return}
@@ -1324,7 +1327,8 @@ function openEv(id,subIdx){
h+="";
h+="";
showModal(h);
- idbGetAll(fk+"_m"+selMonth,function(files){
+ var fk2=fk+"_m"+selMonth;
+ idbGetAll(fk2,function(files){
var fdiv=document.getElementById("fl_"+e.id);if(!fdiv)return;
if(!files||!files.length){fdiv.innerHTML="\u041D\u0435\u0442 \u0444\u0430\u0439\u043B\u043E\u0432";return}
var fh="";var groups={};
@@ -1338,9 +1342,8 @@ function openEv(id,subIdx){
for(var j=0;j0?0:0);var ds="";
- try{var dd=new Date(parseInt(f.id.split("_").pop()));ds=dd.getDate()+"."+String(dd.getMonth()+1).padStart(2,"0")+"."+dd.getFullYear()}catch(e){}
- fh+=""
+ var ds="";var ts=parseInt(f.id.split("_").pop());if(ts>100000){var dd=new Date(ts);ds=dd.getDate()+"."+String(dd.getMonth()+1).padStart(2,"0")+"."+dd.getFullYear()}
+ fh+=""
}
}
fdiv.innerHTML=fh||"\u041D\u0435\u0442 \u0444\u0430\u0439\u043B\u043E\u0432"
@@ -1378,6 +1381,13 @@ function saveEvModal(id){
if(inn)try{localStorage.setItem("sn_"+id+"_m"+mv,inn.value.trim())}catch(e){}
if(inq)try{localStorage.setItem("sq_"+id+"_m"+mv,(parseInt(inq.value,10)||0).toString())}catch(e){}
}
+ var fk="sf_"+id;var mk=inm?"_m"+inm.value:"_m0";
+ idbGetAll(fk+mk,function(files){
+ if(files&&files.length){
+ var meta=[];for(var i=0;i
+