MCPcopy
hub / github.com/nesquena/hermes-webui / showToast

Function showToast

static/ui.js:6895–6910  ·  view source on GitHub ↗
(msg,ms,type)

Source from the content-addressed store, hash-verified

6893 _copyText(text).then(done).catch(()=>{});
6894}
6895function showToast(msg,ms,type){
6896 const el=$('toast');if(!el)return;
6897 const s=String(msg==null?'':msg);let t=type;
6898 if(!t){const low=s.toLowerCase();if(/fail|error|denied|invalid|unavailable|no active|no workspace match|no model match|no personalities/.test(low))t='error';else if(/warn|queued|takes effect|skipped|fallback/.test(low))t='warning';else if(/saved|created|imported|restored|switched|set to|updated|duplicated|moved to|renamed|deleted|complete|pinned|archived|cleared|stopped/.test(low))t='success';else t='info';}
6899 const duration=(ms==null)?(t==='error'?TOAST_ERROR_DEFAULT_MS:TOAST_DEFAULT_MS):ms;
6900 el.className='toast show '+t;
6901 el.dataset.toastMessage=s;
6902 if(t==='error') el.innerHTML=`<span class="toast-message">${esc(s)}</span><button class="toast-copy" type="button" data-toast-copy="1" onclick="copyToastText(this);event.stopPropagation()">Copy</button><button class="toast-dismiss" type="button" aria-label="Dismiss error toast" data-toast-dismiss="1" onclick="dismissToast(this);event.stopPropagation()">Dismiss</button>`;
6903 else el.textContent=s;
6904 el.onmouseenter=()=>clearToastDismissTimer(el);
6905 el.onmouseleave=()=>setToastDismissTimer(el,duration);
6906 el.onfocusin=()=>clearToastDismissTimer(el);
6907 el.onfocusout=()=>setToastDismissTimer(el,duration);
6908 el.onclick=t==='error'?null:()=>dismissToast(el);
6909 setToastDismissTimer(el,duration);
6910}
6911
6912// ── Shared app dialogs ───────────────────────────────────────────────────────
6913// showConfirmDialog(opts) and showPromptDialog(opts) replace browser-native dialog calls

Callers 15

newSessionFunction · 0.85
loadSessionFunction · 0.85
_renderBatchActionBarFunction · 0.85
_showBatchProjectPickerFunction · 0.85
_copySessionLinkFunction · 0.85
finishFunction · 0.85
_archiveSessionFunction · 0.85
_openSessionActionMenuFunction · 0.85
probeGatewaySSEStatusFunction · 0.85

Calls 5

$Function · 0.85
clearToastDismissTimerFunction · 0.85
setToastDismissTimerFunction · 0.85
dismissToastFunction · 0.85
escFunction · 0.70

Tested by

no test coverage detected