Improve chat roster parsing, message read state and loading feedback

This commit is contained in:
alberto committed 2026-10-18 14:35:41 +02:00
1 parent c980ba10de
commit c8941dc199
16 files changed
+183 -20

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
(() => {
let pending=0,showTimer,hideTimer,shownAt=0,indicator;
function mount(){
if(indicator)return;
indicator=document.createElement('div');indicator.className='bpq-busy';indicator.hidden=true;
indicator.setAttribute('role','status');indicator.setAttribute('aria-live','polite');
indicator.innerHTML='<span class="busy-orbit" aria-hidden="true"></span><span>Elaborazione BPQ</span><span class="busy-dots" aria-hidden="true"><i></i><i></i><i></i></span>';
document.body.append(indicator);
}
window.BPQBusy={
start(){
pending++;clearTimeout(hideTimer);
if(pending===1){showTimer=setTimeout(()=>{if(!pending)return;mount();shownAt=Date.now();indicator.hidden=false;document.documentElement.classList.add('bpq-working');},300);}
let finished=false;
return ()=>{
if(finished)return;finished=true;pending=Math.max(0,pending-1);
if(pending)return;
clearTimeout(showTimer);
hideTimer=setTimeout(()=>{if(pending)return;if(indicator)indicator.hidden=true;document.documentElement.classList.remove('bpq-working');},Math.max(0,650-(Date.now()-shownAt)));
};
}
};
})();