KidsExplorer
0 in view
🧸
AI Assistant
亲子出行助手
function shareVenue(){ const id = state.selectedId; if(id == null) return; const v = VENUES.find(x=>x.id===id); const name = v ? (state.lang==='zh'&&v.zh ? v.zh : v.name) : 'Kids Explorer'; const url = location.origin + location.pathname + '#venue=' + encodeURIComponent(id); if(navigator.share){ navigator.share({title:name,text:name,url:url}).catch(()=>{}); } else { navigator.clipboard.writeText(url).then(()=>showShareToast()).catch(()=>{ const ta=document.createElement('textarea'); ta.value=url;ta.style.cssText='position:fixed;opacity:0'; document.body.appendChild(ta);ta.select(); document.execCommand('copy');document.body.removeChild(ta); showShareToast(); }); } } function showShareToast(){ const msg=I18N[state.lang]&&I18N[state.lang].link_copied||'Link copied!'; let toast=document.getElementById('shareToast'); if(!toast){toast=document.createElement('div');toast.id='shareToast'; toast.style.cssText='position:fixed;bottom:80px;left:50%;transform:translateX(-50%);background:#1A2B4A;color:#fff;padding:10px 20px;border-radius:24px;font-size:14px;z-index:9999;pointer-events:none;transition:opacity .3s'; document.body.appendChild(toast);} toast.textContent=msg;toast.style.opacity='1'; setTimeout(()=>{toast.style.opacity='0';},2500); } // Deep link: open venue from URL hash (function(){ const h=location.hash; if(h.startsWith('#venue=')){ const id=decodeURIComponent(h.slice(7)); const numId=parseInt(id); const v=VENUES.find(x=>x.id===(isNaN(numId)?id:numId)); if(v){setTimeout(()=>openDetail(v),500);} } })();