diff --git a/detach.test.mjs b/detach.test.mjs index 75a4a59..9bfd577 100644 --- a/detach.test.mjs +++ b/detach.test.mjs @@ -6,7 +6,7 @@ const source=readFileSync(new URL('./public/detach.js',import.meta.url),'utf8'); function harness(search='',shared=new Map()){ const docEvents={},events={},sections={},calls=[];let serial=0,tick,popup; function element(){const children=new Map();return {hidden:false,dataset:{},textContent:'',className:'',innerHTML:'',classes:new Set(), - classList:{toggle(name,on){this.owner.classes[on?'add':'delete'](name);}},append(child){this.child=child;}, + setAttribute(name,value){this[name]=value;},classList:{toggle(name,on){this.owner.classes[on?'add':'delete'](name);}},append(child){this.child=child;}, querySelector(selector){if(selector==='.detached-placeholder')return this.child||null;if(!children.has(selector))children.set(selector,element());return children.get(selector);}, querySelectorAll(){return [this.querySelector('first'),this.querySelector('second')];}};} for(const id of ['terminal','aprs','monitor','chat']){sections[id]=element();sections[id].classList.owner=sections[id];} diff --git a/public/app.js b/public/app.js index 754e1db..adc0138 100644 --- a/public/app.js +++ b/public/app.js @@ -47,8 +47,9 @@ function applyStation(user){ $('.compose-help').textContent='Il messaggio sarà salvato nella BBS. L’inoltro segue i profili BPQ.'; $('.wl-account').textContent=station.call.replace(/-\d+$/,'')+'@winlink.org'; - $('.chat-empty h2').textContent=station.apps.find(a=>a.command==='CHAT')?.alias||'Chat BPQ'; - $('.chat-empty p').textContent='Connettiti come '+station.call+' per partecipare alla chat.'; + const chatHeading=$('.chat-empty h2'),chatHint=$('.chat-empty p'); + if(chatHeading)chatHeading.textContent=station.apps.find(a=>a.command==='CHAT')?.alias||'Chat BPQ'; + if(chatHint)chatHint.textContent='Connettiti come '+station.call+' per partecipare alla chat.'; for(const feature of ['bbs','chat','winlink','monitor']){const button=$('nav [data-page="'+feature+'"]');if(button)button.hidden=!station.features[feature];} $$('.services-card .service-call').forEach((el,i)=>el.textContent=(station.apps.find(a=>a.command===['BBS','CHAT','RMS'][i])?.call||(i===3?station.nodeCall:'Non configurato'))); $('.services-card .muted').textContent=station.call; diff --git a/public/detach.js b/public/detach.js index 0971d4c..20367a7 100644 --- a/public/detach.js +++ b/public/detach.js @@ -57,6 +57,12 @@ for(const [id,label]of Object.entries(labels)){ const section=document.getElementById(id);if(!section)continue; const heading=section.querySelector('.terminal-actions,.monitor-heading>div,.chat-actions,.page-heading'); + if(view===id&&heading){ + const fullscreen=document.createElement('button');fullscreen.type='button';fullscreen.className='secondary detach-button'; + const update=()=>{const active=!!document.fullscreenElement;fullscreen.textContent=(active?'⊡ ':'⛶ ')+BPQI18n.t(active?'Torna alla finestra':'Schermo intero');fullscreen.setAttribute('aria-pressed',String(active));}; + fullscreen.onclick=async()=>{try{if(document.fullscreenElement)await document.exitFullscreen();else await document.documentElement.requestFullscreen();}catch{if(typeof toast==='function')toast(BPQI18n.t('Schermo intero non disponibile in questo browser. Prova F11.'));}}; + document.addEventListener('fullscreenchange',update);update();heading.append(fullscreen); + } if(id!=='terminal'&&heading){ const button=document.createElement('button');button.type='button';button.className='secondary detach-button';button.dataset.detach=id; button.textContent=view===id?'↙ Torna al pannello':'↗ Stacca';button.onclick=()=>view===id?dock(id):open(id);heading.append(button); diff --git a/public/forwarding.js b/public/forwarding.js index 494b33e..a5b654c 100644 --- a/public/forwarding.js +++ b/public/forwarding.js @@ -8,7 +8,7 @@ const interval=n=>!n?'Non impostato':n%3600===0?n/3600+' h':n%60===0?n/60+' min' const state=s=>({complete:'Completato',calling:'Chiamata in corso',connected:'Collegato',failed:'Non riuscito',incomplete:'Sessione interrotta',unknown:'Esito non registrato'}[s]||'In attesa'); const rules=(values,kind)=>!values.length?'Nessuna regola esplicita':values.includes('WW')?(kind==='bulletins'?'Tutte le aree geografiche':'Destinazioni geografiche tramite questo partner'):values.join(', '); const bands=p=>p.times.length?p.times.map(t=>t.replace(/^(\d{2})(\d{2})-(\d{2})(\d{2})$/,'$1:$2–$3:$4')).join(' · '):'00:00–23:59'; -function render(){if(!data)return;$('#forward-restore').hidden=!(data.manualSession?.restoring&&data.manualSession?.error);const focused=document.activeElement,focusPeer=focused.closest?.('[data-forward-row]')?.dataset.forwardRow,focusKind=focused.matches?.('[data-forward-start]')?'[data-forward-start]':focused.matches?.('.forward-toggle')?'.forward-toggle':null;const profiles=[...data.profiles].sort((a,b)=>Number(b.enabled&&b.configured)-Number(a.enabled&&a.configured)||Number(b.transport==='Radio')-Number(a.transport==='Radio')||a.call.localeCompare(b.call)),total=profiles.reduce((a,p)=>a+((p.manualOnly||p.scheduled)?0:p.queued||0),0);$('#forward-summary').innerHTML=[['Percorsi',profiles.length],['Automatici',profiles.filter(p=>p.enabled&&p.configured).length],['Messaggi in coda',total+(profiles.some(p=>p.queued===null)?' + ?':'')],['Sessioni attive',profiles.filter(p=>p.active).length]].map(([label,n])=>'
| Partner / percorso | Stato | Coda | Ultimo scambio | TX / RX | Programmazione | Prossimo · stima | Azioni |
|---|
Nessun partner di forwarding configurato in BPQ.
':'')+'${esc(p.bulletins.join(', '))}${esc(p.personal.join(', '))}${(p.manualOnly||p.scheduled)?'Stessa coda e stesse regole del partner '+esc(p.peer)+(p.scheduled?'. Sync automatico gestito dalla console. ':'. Nessun timer automatico per questo percorso. '):''}Le regole geografiche dipendono dagli indirizzi gerarchici e dalle altre rotte BPQ. I messaggi locali e quelli già ricevuti dal partner seguono le regole di esclusione di BPQ.
${esc(p.script.join('\n')||'Nessuno script configurato')}${esc(p.ha||'Non impostato')}
${p.frequency?'Dial: '+esc(p.frequency.join(' MHz '))+'
':''}| Data e ora | Direzione | TX / RX | Esito |
|---|---|---|---|
| '+esc(time(s.startedAt))+' | '+(s.direction==='incoming'?'Ingresso':'Uscita')+' | '+s.sent+' / '+s.received+' | '+esc(state(s.status))+' |
| Nessuno scambio nei sette file di log più recenti. | |||
${esc(p.bulletins.join(', '))}${esc(p.personal.join(', '))}${(p.manualOnly||p.scheduled)?'Stessa coda e stesse regole del partner '+esc(p.peer)+(p.scheduled?'. Sync automatico gestito dalla console. ':'. Nessun timer automatico per questo percorso. '):''}Le regole geografiche dipendono dagli indirizzi gerarchici e dalle altre rotte BPQ. I messaggi locali e quelli già ricevuti dal partner seguono le regole di esclusione di BPQ.
${esc(p.script.join('\n')||'Nessuno script configurato')}${esc(p.ha||'Non impostato')}
${p.frequency?'Dial: '+esc(p.frequency.join(' MHz '))+'
':''}'+esc(time(data.manualSession.endedAt||data.manualSession.startedAt))+' \u00b7 '+esc(BPQI18n.t(data.manualSession.error))+'
':''}| Data e ora | Direzione | TX / RX | Esito |
|---|---|---|---|
| '+esc(time(s.startedAt))+' | '+(s.direction==='incoming'?'Ingresso':'Uscita')+' | '+s.sent+' / '+s.received+' | '+esc(state(s.status))+' |
| Nessuno scambio nei sette file di log più recenti. | |||