prts-moonlit 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gacha.html +16 -12
- package/index.html +16 -12
- package/ledger.html +16 -12
- package/package.json +1 -1
package/gacha.html
CHANGED
|
@@ -1053,7 +1053,7 @@ document.addEventListener('pointerdown',function(){ac()},{once:true});
|
|
|
1053
1053
|
var BASE='https://textdb.dev/api/data/prts-acct-';
|
|
1054
1054
|
var LS='whale.acct',LT='whale.sync.t';
|
|
1055
1055
|
var acct=null;try{acct=JSON.parse(localStorage.getItem(LS)||'null')}catch(e){}
|
|
1056
|
-
var _si=localStorage.setItem.bind(localStorage),_app=0,pq=0,box=null,_dirty=0;
|
|
1056
|
+
var _si=localStorage.setItem.bind(localStorage),_app=0,pq=0,box=null,_dirty=0,lastSnap=null;
|
|
1057
1057
|
|
|
1058
1058
|
function sha(msg){
|
|
1059
1059
|
function r(v,n){return (v>>>n)|(v<<(32-n));}
|
|
@@ -1083,35 +1083,37 @@ document.addEventListener('pointerdown',function(){ac()},{once:true});
|
|
|
1083
1083
|
}
|
|
1084
1084
|
function snap(){var d={};for(var i=0;i<TK.length;i++){var v=localStorage.getItem(TK[i]);if(v!==null)d[TK[i]]=v;}return d;}
|
|
1085
1085
|
function url(){return BASE+acct.k;}
|
|
1086
|
+
function wxhr(u,b,cb){try{var x=new XMLHttpRequest();x.open('POST',u,true);x.setRequestHeader('Content-Type','text/plain');x.onload=x.onerror=x.ontimeout=function(){if(cb)cb()};x.send(b);}catch(e){if(cb)cb();}}
|
|
1087
|
+
function canon(){var a=[];for(var i=0;i<TK.length;i++)a.push(TK[i]+'='+localStorage.getItem(TK[i]));return a.join('|');}
|
|
1086
1088
|
function st(m){if(box&&box.st)box.st.textContent=m;}
|
|
1087
1089
|
function clock(){var d=new Date();function p(n){return(n<10?'0':'')+n}return p(d.getHours())+':'+p(d.getMinutes())+':'+p(d.getSeconds());}
|
|
1088
1090
|
function apply(rb){
|
|
1089
1091
|
_app=1;try{for(var k in rb.data){_si(k,rb.data[k]);}}finally{_app=0;}
|
|
1090
|
-
_si(LT,String(rb.t||Date.now()));
|
|
1092
|
+
_si(LT,String(rb.t||Date.now()));lastSnap=canon();
|
|
1091
1093
|
st('✔ 已从云端同步 '+clock()+',即将刷新…');
|
|
1092
1094
|
setTimeout(function(){location.reload();},350);
|
|
1093
1095
|
}
|
|
1094
|
-
function push(){
|
|
1096
|
+
function push(ry){
|
|
1095
1097
|
if(!acct||!acct.k)return;
|
|
1096
|
-
|
|
1098
|
+
if(!ry)window.__pv=0;
|
|
1099
|
+
_dirty=0;var t=Date.now();_si(LT,String(t));lastSnap=canon();
|
|
1097
1100
|
st('↻ 同步中…');
|
|
1098
|
-
|
|
1099
|
-
.then(function(){st('✔ 已上传 · 后台校验…');setTimeout(function(){verify(t)},600);})
|
|
1100
|
-
.catch(function(){st('⚠ 云同步暂不可用(可用存档码手动搬)');});
|
|
1101
|
+
wxhr(url(),JSON.stringify({v:1,u:acct.u,t:t,data:snap()}),function(){st('✔ 已上传 · 后台校验…');setTimeout(function(){verify(t)},600);});
|
|
1101
1102
|
}
|
|
1102
1103
|
function verify(t){
|
|
1103
1104
|
fetch(url()+'?ts='+Date.now(),{cache:'no-store'}).then(function(r){return r.text()}).then(function(x){
|
|
1104
1105
|
x=(x||'').replace(/=$/,'');
|
|
1105
1106
|
try{var rb=JSON.parse(x);if(rb.t===t){st('✔ 已同步 '+clock());return;}}catch(e){}
|
|
1106
|
-
if(!window.__pv){window.__pv=1;setTimeout(function(){
|
|
1107
|
-
else{st('⚠
|
|
1107
|
+
if(!window.__pv){window.__pv=1;setTimeout(function(){push(1);},800);}
|
|
1108
|
+
else{window.__pv=0;st('⚠ 上传好像没送达(此浏览器限制跨域)——数据还在本机,可换 Safari 或用存档码');}
|
|
1108
1109
|
}).catch(function(){st('⚠ 校验失败(可能网络受限)');});
|
|
1109
1110
|
}
|
|
1110
1111
|
function pull(manual){
|
|
1111
1112
|
if(!acct||!acct.k)return;
|
|
1113
|
+
if(manual)st('↻ 同步中…');
|
|
1112
1114
|
fetch(url()+'?ts='+Date.now(),{cache:'no-store'}).then(function(r){return r.text()}).then(function(x){
|
|
1113
1115
|
x=(x||'').replace(/=$/,'');
|
|
1114
|
-
if(!x){if(manual)st('☁
|
|
1116
|
+
if(!x){if(manual){st('☁ 云端还没有存档——正在上传本机数据…');push();}return;}
|
|
1115
1117
|
var rb;try{rb=JSON.parse(x)}catch(e){st('⚠ 云端数据格式异常');return;}
|
|
1116
1118
|
var lt=Number(localStorage.getItem(LT)||0);
|
|
1117
1119
|
if((rb.t||0)>lt){
|
|
@@ -1209,7 +1211,7 @@ document.addEventListener('pointerdown',function(){ac()},{once:true});
|
|
|
1209
1211
|
localStorage.setItem=function(k,v){_orig.call(localStorage,k,v);if(!_app&&acct&&acct.k&&TK.indexOf(k)>=0&&k!==LT){_dirty=1;clearTimeout(pq);pq=setTimeout(push,900);}};
|
|
1210
1212
|
window.addEventListener('pagehide',function(){
|
|
1211
1213
|
if(acct&&acct.k&&_dirty){try{_dirty=0;_si(LT,String(Date.now()));
|
|
1212
|
-
|
|
1214
|
+
var x=new XMLHttpRequest();x.open('POST',url(),false);x.setRequestHeader('Content-Type','text/plain');x.send(JSON.stringify({v:1,u:acct.u,t:Date.now(),data:snap()}));}catch(e){}}
|
|
1213
1215
|
});
|
|
1214
1216
|
document.addEventListener('visibilitychange',function(){if(!document.hidden&&acct&&acct.k&&!wrap.classList.contains('on'))pull(false);});
|
|
1215
1217
|
setInterval(function(){if(!document.hidden&&acct&&acct.k&&!wrap.classList.contains('on'))pull(false);},15000);
|
|
@@ -1219,9 +1221,11 @@ document.addEventListener('pointerdown',function(){ac()},{once:true});
|
|
|
1219
1221
|
else{btn.textContent='@';btn.style.cssText='position:fixed;right:14px;bottom:60px;z-index:120;width:38px;height:38px;display:flex;align-items:center;justify-content:center;border:2px solid #4cc9ff;background:rgba(7,12,24,.92);color:#4cc9ff;font-size:17px;cursor:pointer;user-select:none;box-shadow:3px 3px 0 rgba(0,0,0,.45)';document.body.appendChild(btn);}
|
|
1220
1222
|
btn.id='acctBtn';btn.title='云存档';
|
|
1221
1223
|
if(acct)btn.style.background='rgba(76,201,255,.28)';
|
|
1224
|
+
lastSnap=canon();
|
|
1222
1225
|
btn.addEventListener('click',open);
|
|
1226
|
+
setInterval(function(){if(acct&&acct.k){var c=canon();if(c!==lastSnap){lastSnap=c;clearTimeout(pq);pq=setTimeout(push,900);}}},2000);
|
|
1223
1227
|
if(acct&&acct.k){setTimeout(function(){pull(false);},250);}
|
|
1224
|
-
window.__shaT=sha;
|
|
1228
|
+
window.__shaT=sha;window.__pushT=push;window.__pullT=pull;window.__canonT=canon;
|
|
1225
1229
|
})();
|
|
1226
1230
|
</script>
|
|
1227
1231
|
</body>
|
package/index.html
CHANGED
|
@@ -2767,7 +2767,7 @@ boot();
|
|
|
2767
2767
|
var BASE='https://textdb.dev/api/data/prts-acct-';
|
|
2768
2768
|
var LS='whale.acct',LT='whale.sync.t';
|
|
2769
2769
|
var acct=null;try{acct=JSON.parse(localStorage.getItem(LS)||'null')}catch(e){}
|
|
2770
|
-
var _si=localStorage.setItem.bind(localStorage),_app=0,pq=0,box=null,_dirty=0;
|
|
2770
|
+
var _si=localStorage.setItem.bind(localStorage),_app=0,pq=0,box=null,_dirty=0,lastSnap=null;
|
|
2771
2771
|
|
|
2772
2772
|
function sha(msg){
|
|
2773
2773
|
function r(v,n){return (v>>>n)|(v<<(32-n));}
|
|
@@ -2797,35 +2797,37 @@ boot();
|
|
|
2797
2797
|
}
|
|
2798
2798
|
function snap(){var d={};for(var i=0;i<TK.length;i++){var v=localStorage.getItem(TK[i]);if(v!==null)d[TK[i]]=v;}return d;}
|
|
2799
2799
|
function url(){return BASE+acct.k;}
|
|
2800
|
+
function wxhr(u,b,cb){try{var x=new XMLHttpRequest();x.open('POST',u,true);x.setRequestHeader('Content-Type','text/plain');x.onload=x.onerror=x.ontimeout=function(){if(cb)cb()};x.send(b);}catch(e){if(cb)cb();}}
|
|
2801
|
+
function canon(){var a=[];for(var i=0;i<TK.length;i++)a.push(TK[i]+'='+localStorage.getItem(TK[i]));return a.join('|');}
|
|
2800
2802
|
function st(m){if(box&&box.st)box.st.textContent=m;}
|
|
2801
2803
|
function clock(){var d=new Date();function p(n){return(n<10?'0':'')+n}return p(d.getHours())+':'+p(d.getMinutes())+':'+p(d.getSeconds());}
|
|
2802
2804
|
function apply(rb){
|
|
2803
2805
|
_app=1;try{for(var k in rb.data){_si(k,rb.data[k]);}}finally{_app=0;}
|
|
2804
|
-
_si(LT,String(rb.t||Date.now()));
|
|
2806
|
+
_si(LT,String(rb.t||Date.now()));lastSnap=canon();
|
|
2805
2807
|
st('✔ 已从云端同步 '+clock()+',即将刷新…');
|
|
2806
2808
|
setTimeout(function(){location.reload();},350);
|
|
2807
2809
|
}
|
|
2808
|
-
function push(){
|
|
2810
|
+
function push(ry){
|
|
2809
2811
|
if(!acct||!acct.k)return;
|
|
2810
|
-
|
|
2812
|
+
if(!ry)window.__pv=0;
|
|
2813
|
+
_dirty=0;var t=Date.now();_si(LT,String(t));lastSnap=canon();
|
|
2811
2814
|
st('↻ 同步中…');
|
|
2812
|
-
|
|
2813
|
-
.then(function(){st('✔ 已上传 · 后台校验…');setTimeout(function(){verify(t)},600);})
|
|
2814
|
-
.catch(function(){st('⚠ 云同步暂不可用(可用存档码手动搬)');});
|
|
2815
|
+
wxhr(url(),JSON.stringify({v:1,u:acct.u,t:t,data:snap()}),function(){st('✔ 已上传 · 后台校验…');setTimeout(function(){verify(t)},600);});
|
|
2815
2816
|
}
|
|
2816
2817
|
function verify(t){
|
|
2817
2818
|
fetch(url()+'?ts='+Date.now(),{cache:'no-store'}).then(function(r){return r.text()}).then(function(x){
|
|
2818
2819
|
x=(x||'').replace(/=$/,'');
|
|
2819
2820
|
try{var rb=JSON.parse(x);if(rb.t===t){st('✔ 已同步 '+clock());return;}}catch(e){}
|
|
2820
|
-
if(!window.__pv){window.__pv=1;setTimeout(function(){
|
|
2821
|
-
else{st('⚠
|
|
2821
|
+
if(!window.__pv){window.__pv=1;setTimeout(function(){push(1);},800);}
|
|
2822
|
+
else{window.__pv=0;st('⚠ 上传好像没送达(此浏览器限制跨域)——数据还在本机,可换 Safari 或用存档码');}
|
|
2822
2823
|
}).catch(function(){st('⚠ 校验失败(可能网络受限)');});
|
|
2823
2824
|
}
|
|
2824
2825
|
function pull(manual){
|
|
2825
2826
|
if(!acct||!acct.k)return;
|
|
2827
|
+
if(manual)st('↻ 同步中…');
|
|
2826
2828
|
fetch(url()+'?ts='+Date.now(),{cache:'no-store'}).then(function(r){return r.text()}).then(function(x){
|
|
2827
2829
|
x=(x||'').replace(/=$/,'');
|
|
2828
|
-
if(!x){if(manual)st('☁
|
|
2830
|
+
if(!x){if(manual){st('☁ 云端还没有存档——正在上传本机数据…');push();}return;}
|
|
2829
2831
|
var rb;try{rb=JSON.parse(x)}catch(e){st('⚠ 云端数据格式异常');return;}
|
|
2830
2832
|
var lt=Number(localStorage.getItem(LT)||0);
|
|
2831
2833
|
if((rb.t||0)>lt){
|
|
@@ -2923,7 +2925,7 @@ boot();
|
|
|
2923
2925
|
localStorage.setItem=function(k,v){_orig.call(localStorage,k,v);if(!_app&&acct&&acct.k&&TK.indexOf(k)>=0&&k!==LT){_dirty=1;clearTimeout(pq);pq=setTimeout(push,900);}};
|
|
2924
2926
|
window.addEventListener('pagehide',function(){
|
|
2925
2927
|
if(acct&&acct.k&&_dirty){try{_dirty=0;_si(LT,String(Date.now()));
|
|
2926
|
-
|
|
2928
|
+
var x=new XMLHttpRequest();x.open('POST',url(),false);x.setRequestHeader('Content-Type','text/plain');x.send(JSON.stringify({v:1,u:acct.u,t:Date.now(),data:snap()}));}catch(e){}}
|
|
2927
2929
|
});
|
|
2928
2930
|
document.addEventListener('visibilitychange',function(){if(!document.hidden&&acct&&acct.k&&!wrap.classList.contains('on'))pull(false);});
|
|
2929
2931
|
setInterval(function(){if(!document.hidden&&acct&&acct.k&&!wrap.classList.contains('on'))pull(false);},15000);
|
|
@@ -2933,9 +2935,11 @@ boot();
|
|
|
2933
2935
|
else{btn.textContent='@';btn.style.cssText='position:fixed;right:14px;bottom:60px;z-index:120;width:38px;height:38px;display:flex;align-items:center;justify-content:center;border:2px solid #4cc9ff;background:rgba(7,12,24,.92);color:#4cc9ff;font-size:17px;cursor:pointer;user-select:none;box-shadow:3px 3px 0 rgba(0,0,0,.45)';document.body.appendChild(btn);}
|
|
2934
2936
|
btn.id='acctBtn';btn.title='云存档';
|
|
2935
2937
|
if(acct)btn.style.background='rgba(76,201,255,.28)';
|
|
2938
|
+
lastSnap=canon();
|
|
2936
2939
|
btn.addEventListener('click',open);
|
|
2940
|
+
setInterval(function(){if(acct&&acct.k){var c=canon();if(c!==lastSnap){lastSnap=c;clearTimeout(pq);pq=setTimeout(push,900);}}},2000);
|
|
2937
2941
|
if(acct&&acct.k){setTimeout(function(){pull(false);},250);}
|
|
2938
|
-
window.__shaT=sha;
|
|
2942
|
+
window.__shaT=sha;window.__pushT=push;window.__pullT=pull;window.__canonT=canon;
|
|
2939
2943
|
})();
|
|
2940
2944
|
</script>
|
|
2941
2945
|
</body>
|
package/ledger.html
CHANGED
|
@@ -1013,7 +1013,7 @@ window.LEDGER_BACKUP = [];
|
|
|
1013
1013
|
var BASE='https://textdb.dev/api/data/prts-acct-';
|
|
1014
1014
|
var LS='whale.acct',LT='whale.sync.t';
|
|
1015
1015
|
var acct=null;try{acct=JSON.parse(localStorage.getItem(LS)||'null')}catch(e){}
|
|
1016
|
-
var _si=localStorage.setItem.bind(localStorage),_app=0,pq=0,box=null,_dirty=0;
|
|
1016
|
+
var _si=localStorage.setItem.bind(localStorage),_app=0,pq=0,box=null,_dirty=0,lastSnap=null;
|
|
1017
1017
|
|
|
1018
1018
|
function sha(msg){
|
|
1019
1019
|
function r(v,n){return (v>>>n)|(v<<(32-n));}
|
|
@@ -1043,35 +1043,37 @@ window.LEDGER_BACKUP = [];
|
|
|
1043
1043
|
}
|
|
1044
1044
|
function snap(){var d={};for(var i=0;i<TK.length;i++){var v=localStorage.getItem(TK[i]);if(v!==null)d[TK[i]]=v;}return d;}
|
|
1045
1045
|
function url(){return BASE+acct.k;}
|
|
1046
|
+
function wxhr(u,b,cb){try{var x=new XMLHttpRequest();x.open('POST',u,true);x.setRequestHeader('Content-Type','text/plain');x.onload=x.onerror=x.ontimeout=function(){if(cb)cb()};x.send(b);}catch(e){if(cb)cb();}}
|
|
1047
|
+
function canon(){var a=[];for(var i=0;i<TK.length;i++)a.push(TK[i]+'='+localStorage.getItem(TK[i]));return a.join('|');}
|
|
1046
1048
|
function st(m){if(box&&box.st)box.st.textContent=m;}
|
|
1047
1049
|
function clock(){var d=new Date();function p(n){return(n<10?'0':'')+n}return p(d.getHours())+':'+p(d.getMinutes())+':'+p(d.getSeconds());}
|
|
1048
1050
|
function apply(rb){
|
|
1049
1051
|
_app=1;try{for(var k in rb.data){_si(k,rb.data[k]);}}finally{_app=0;}
|
|
1050
|
-
_si(LT,String(rb.t||Date.now()));
|
|
1052
|
+
_si(LT,String(rb.t||Date.now()));lastSnap=canon();
|
|
1051
1053
|
st('✔ 已从云端同步 '+clock()+',即将刷新…');
|
|
1052
1054
|
setTimeout(function(){location.reload();},350);
|
|
1053
1055
|
}
|
|
1054
|
-
function push(){
|
|
1056
|
+
function push(ry){
|
|
1055
1057
|
if(!acct||!acct.k)return;
|
|
1056
|
-
|
|
1058
|
+
if(!ry)window.__pv=0;
|
|
1059
|
+
_dirty=0;var t=Date.now();_si(LT,String(t));lastSnap=canon();
|
|
1057
1060
|
st('↻ 同步中…');
|
|
1058
|
-
|
|
1059
|
-
.then(function(){st('✔ 已上传 · 后台校验…');setTimeout(function(){verify(t)},600);})
|
|
1060
|
-
.catch(function(){st('⚠ 云同步暂不可用(可用存档码手动搬)');});
|
|
1061
|
+
wxhr(url(),JSON.stringify({v:1,u:acct.u,t:t,data:snap()}),function(){st('✔ 已上传 · 后台校验…');setTimeout(function(){verify(t)},600);});
|
|
1061
1062
|
}
|
|
1062
1063
|
function verify(t){
|
|
1063
1064
|
fetch(url()+'?ts='+Date.now(),{cache:'no-store'}).then(function(r){return r.text()}).then(function(x){
|
|
1064
1065
|
x=(x||'').replace(/=$/,'');
|
|
1065
1066
|
try{var rb=JSON.parse(x);if(rb.t===t){st('✔ 已同步 '+clock());return;}}catch(e){}
|
|
1066
|
-
if(!window.__pv){window.__pv=1;setTimeout(function(){
|
|
1067
|
-
else{st('⚠
|
|
1067
|
+
if(!window.__pv){window.__pv=1;setTimeout(function(){push(1);},800);}
|
|
1068
|
+
else{window.__pv=0;st('⚠ 上传好像没送达(此浏览器限制跨域)——数据还在本机,可换 Safari 或用存档码');}
|
|
1068
1069
|
}).catch(function(){st('⚠ 校验失败(可能网络受限)');});
|
|
1069
1070
|
}
|
|
1070
1071
|
function pull(manual){
|
|
1071
1072
|
if(!acct||!acct.k)return;
|
|
1073
|
+
if(manual)st('↻ 同步中…');
|
|
1072
1074
|
fetch(url()+'?ts='+Date.now(),{cache:'no-store'}).then(function(r){return r.text()}).then(function(x){
|
|
1073
1075
|
x=(x||'').replace(/=$/,'');
|
|
1074
|
-
if(!x){if(manual)st('☁
|
|
1076
|
+
if(!x){if(manual){st('☁ 云端还没有存档——正在上传本机数据…');push();}return;}
|
|
1075
1077
|
var rb;try{rb=JSON.parse(x)}catch(e){st('⚠ 云端数据格式异常');return;}
|
|
1076
1078
|
var lt=Number(localStorage.getItem(LT)||0);
|
|
1077
1079
|
if((rb.t||0)>lt){
|
|
@@ -1169,7 +1171,7 @@ window.LEDGER_BACKUP = [];
|
|
|
1169
1171
|
localStorage.setItem=function(k,v){_orig.call(localStorage,k,v);if(!_app&&acct&&acct.k&&TK.indexOf(k)>=0&&k!==LT){_dirty=1;clearTimeout(pq);pq=setTimeout(push,900);}};
|
|
1170
1172
|
window.addEventListener('pagehide',function(){
|
|
1171
1173
|
if(acct&&acct.k&&_dirty){try{_dirty=0;_si(LT,String(Date.now()));
|
|
1172
|
-
|
|
1174
|
+
var x=new XMLHttpRequest();x.open('POST',url(),false);x.setRequestHeader('Content-Type','text/plain');x.send(JSON.stringify({v:1,u:acct.u,t:Date.now(),data:snap()}));}catch(e){}}
|
|
1173
1175
|
});
|
|
1174
1176
|
document.addEventListener('visibilitychange',function(){if(!document.hidden&&acct&&acct.k&&!wrap.classList.contains('on'))pull(false);});
|
|
1175
1177
|
setInterval(function(){if(!document.hidden&&acct&&acct.k&&!wrap.classList.contains('on'))pull(false);},15000);
|
|
@@ -1179,9 +1181,11 @@ window.LEDGER_BACKUP = [];
|
|
|
1179
1181
|
else{btn.textContent='@';btn.style.cssText='position:fixed;right:14px;bottom:60px;z-index:120;width:38px;height:38px;display:flex;align-items:center;justify-content:center;border:2px solid #4cc9ff;background:rgba(7,12,24,.92);color:#4cc9ff;font-size:17px;cursor:pointer;user-select:none;box-shadow:3px 3px 0 rgba(0,0,0,.45)';document.body.appendChild(btn);}
|
|
1180
1182
|
btn.id='acctBtn';btn.title='云存档';
|
|
1181
1183
|
if(acct)btn.style.background='rgba(76,201,255,.28)';
|
|
1184
|
+
lastSnap=canon();
|
|
1182
1185
|
btn.addEventListener('click',open);
|
|
1186
|
+
setInterval(function(){if(acct&&acct.k){var c=canon();if(c!==lastSnap){lastSnap=c;clearTimeout(pq);pq=setTimeout(push,900);}}},2000);
|
|
1183
1187
|
if(acct&&acct.k){setTimeout(function(){pull(false);},250);}
|
|
1184
|
-
window.__shaT=sha;
|
|
1188
|
+
window.__shaT=sha;window.__pushT=push;window.__pullT=pull;window.__canonT=canon;
|
|
1185
1189
|
})();
|
|
1186
1190
|
</script>
|
|
1187
1191
|
</body>
|