Admin page: an error toast no longer throws for want of haptic (#436)

toast() calls haptic() on an error since cf0dad7 (#430), and haptic is
native.ts's, which admin.js is not built from: every error toast on the
admin page threw a ReferenceError and showed nothing. Never deployed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 00:04:12 +00:00
parent da6cda28a5
commit 8f888ae10e

View File

@@ -228,7 +228,8 @@ async function share(title: string, url: string, btn?: HTMLElement){
function toast(msg: string, bad?: boolean){ function toast(msg: string, bad?: boolean){
const t=document.createElement('div'), box=$('#toasts'); const t=document.createElement('div'), box=$('#toasts');
t.className='toast'+(bad?' bad':''); t.textContent=msg; t.className='toast'+(bad?' bad':''); t.textContent=msg;
if(bad) haptic('warn'); // haptic is native.ts's, which the admin page's script is not built from (#436).
if(bad && typeof haptic==='function') haptic('warn');
const go=()=>{t.style.opacity='0';t.style.transition='opacity .3s';setTimeout(()=>t.remove(),320)}; const go=()=>{t.style.opacity='0';t.style.transition='opacity .3s';setTimeout(()=>t.remove(),320)};
// An error stays until it is put away: gone after six seconds, it was easy to miss and could not // An error stays until it is put away: gone after six seconds, it was easy to miss and could not
// be read again (#303). // be read again (#303).