/** * VNEWS Frontend v2 - Shorts Dantri/SKDS removed, VTV Digital CDN * v2.8 - Changed short AI feed video share button icon (📥) to distinguish from article share (📤) * v2.6 - Fixed share links: doShare now includes post_id for wall posts, * readSlidePost has share button, /s + /s/{slug} render slides/video inline * v2.5 - Added 'Tạo lại' button on wall cards with video * v2.4 - Fixed: prependWallPost detached-element bug, makeShortVideo UI update, slide viewer for rewrite posts */ function _proxyImg(url){ if(!url || typeof url !== 'string') return ''; if(url.startsWith('http') && !url.includes(location.host)){ return '/api/proxy/img?url='+encodeURIComponent(url); } return url; } var _ttsSelections = {}; function _fetchWithTimeout(url, ms){ return new Promise((resolve,reject)=>{ const ctrl=new AbortController(); const tid=setTimeout(()=>ctrl.abort(),ms); fetch(url,{signal:ctrl.signal}).then(r=>{ clearTimeout(tid); if(!r.ok) return reject(new Error('HTTP '+r.status)); return r.json(); }).then(d=>resolve(d)).catch(e=>{clearTimeout(tid);reject(e);}); }); } async function loadHome(){ const homeEl = document.getElementById('view-home'); if(!homeEl) return; homeEl.innerHTML = '
' +'${esc(b.text)}
`;else if(b.type==='heading')h+=`Không thể tải bài viết