Spaces:
Running
Running
Upload static/index_v2.html
Browse files- static/index_v2.html +35 -2
static/index_v2.html
CHANGED
|
@@ -34,7 +34,40 @@
|
|
| 34 |
<script src="/static/live_mode.js"></script>
|
| 35 |
<script src="/static/match_detail_v6.js"></script>
|
| 36 |
<script>init();</script>
|
| 37 |
-
<script
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
</body>
|
| 40 |
</html>
|
|
|
|
| 34 |
<script src="/static/live_mode.js"></script>
|
| 35 |
<script src="/static/match_detail_v6.js"></script>
|
| 36 |
<script>init();</script>
|
| 37 |
+
<script>
|
| 38 |
+
// Wall AI Fix - Direct render after all scripts load
|
| 39 |
+
(function(){
|
| 40 |
+
const MAX_AGE_MS=86400000; // 24h
|
| 41 |
+
function esc(s){return String(s||'').replace(/[&<>"']/g,m=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[m]));}
|
| 42 |
+
function renderWall(posts){
|
| 43 |
+
const home=document.getElementById('view-home'); if(!home) return;
|
| 44 |
+
const aiShorts=posts.filter(p=>p.video);
|
| 45 |
+
if(aiShorts.length){
|
| 46 |
+
const wrap=document.createElement('div'); wrap.className='slider-wrap'; wrap.id='short-ai-section';
|
| 47 |
+
let h='<div class="slider-header"><span class="slider-label">🎬 Short AI (24h)</span></div><div class="slider-track">';
|
| 48 |
+
aiShorts.slice(0,20).forEach((p,i)=>{h+=`<div class="slider-item shorts-item" onclick="openShortAIFeed(${i})"><div class="slider-thumb shorts-thumb"><video src="${p.video}" muted preload="metadata"></video><div class="card-play">▶</div></div><div class="slider-title">${esc(p.title)}</div></div>`;});
|
| 49 |
+
h+='</div>'; wrap.innerHTML=h; home.appendChild(wrap);
|
| 50 |
+
}
|
| 51 |
+
const wrap2=document.createElement('div'); wrap2.className='slider-wrap'; wrap2.id='ai-wall-wrap';
|
| 52 |
+
let h2='<div class="slider-header"><span class="slider-label">🧱 Tường AI (24h)</span></div><div class="slider-track" id="ai-wall-track">';
|
| 53 |
+
posts.slice(0,30).forEach((p,i)=>{h2+=`<div class="wall-item" id="wall-item-${p.id}"><div class="wall-thumb">${p.img?`<img src="${p.img}">`:(p.video?`<video src="${p.video}" muted></video>`:'')}</div><div class="wall-title">${esc(p.title)}</div></div>`;});
|
| 54 |
+
h2+='</div>'; wrap2.innerHTML=h2; home.appendChild(wrap2);
|
| 55 |
+
console.log('[Wall] Rendered '+posts.length+' posts');
|
| 56 |
+
}
|
| 57 |
+
async function load(){
|
| 58 |
+
try{
|
| 59 |
+
let posts=window._wallPosts||[];
|
| 60 |
+
if(!posts.length){
|
| 61 |
+
const r=await fetch('/api/wall/24h?t='+Date.now());
|
| 62 |
+
const j=await r.json(); posts=j.posts||[];
|
| 63 |
+
}
|
| 64 |
+
if(posts.length) renderWall(posts);
|
| 65 |
+
}catch(e){console.log('[Wall] Error',e);}
|
| 66 |
+
}
|
| 67 |
+
// Chờ loadHome hoàn thành
|
| 68 |
+
let tries=0; const int=setInterval(()=>{if(window._wallPosts||tries>30) load(); tries++; if(tries>30) clearInterval(int);},2000);
|
| 69 |
+
})();
|
| 70 |
+
</script>
|
| 71 |
+
<script src="/static/shorts_fresh.js?v=2026063005"></script>
|
| 72 |
</body>
|
| 73 |
</html>
|