Spaces:
Running
Running
Upload static/wc2026_v2.js with huggingface_hub
Browse files- static/wc2026_v2.js +14 -11
static/wc2026_v2.js
CHANGED
|
@@ -109,23 +109,26 @@ function renderWCStats(el){
|
|
| 109 |
else el.innerHTML='<div class="loading">Thống kê cập nhật khi giải bắt đầu<br><small style="color:#6a9fca">Vua phá lưới · Kiến tạo · Thẻ phạt</small></div>';
|
| 110 |
}
|
| 111 |
|
| 112 |
-
// === HIGHLIGHTS (WC
|
| 113 |
async function renderWCHighlights(el){
|
| 114 |
-
el.innerHTML='<div class="loading">Đang tải highlight...</div>';
|
| 115 |
try{
|
| 116 |
-
//
|
| 117 |
const[wc,fr]=await Promise.all([
|
| 118 |
-
fetch('/api/
|
| 119 |
fetch('/api/highlights/friendly').then(r=>r.json()).catch(()=>[])
|
| 120 |
]);
|
| 121 |
-
|
| 122 |
-
const
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
|
|
|
|
|
|
| 126 |
const league=v._league==='WC'?'world-cup':'friendly';
|
| 127 |
-
const badge=v._league==='WC'?'🌍 WC':'🤝
|
| 128 |
-
|
|
|
|
| 129 |
h+=`<div style="position:relative;aspect-ratio:16/9;background:#1a2a3a">${v.img?`<img src="${esc(v.img)}" style="width:100%;height:100%;object-fit:cover">`:''}<div class="card-play">▶</div></div>`;
|
| 130 |
h+=`<div style="padding:4px 6px"><span style="font-size:8px;color:#f0c040">${badge}</span><div style="font-size:10px;color:#ccc;line-height:1.2;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden">${esc(v.title)}</div></div>`;
|
| 131 |
h+='</div>';
|
|
|
|
| 109 |
else el.innerHTML='<div class="loading">Thống kê cập nhật khi giải bắt đầu<br><small style="color:#6a9fca">Vua phá lưới · Kiến tạo · Thẻ phạt</small></div>';
|
| 110 |
}
|
| 111 |
|
| 112 |
+
// === HIGHLIGHTS (WC from xemlaibongda.top API) ===
|
| 113 |
async function renderWCHighlights(el){
|
| 114 |
+
el.innerHTML='<div class="loading">Đang tải highlight World Cup...</div>';
|
| 115 |
try{
|
| 116 |
+
// Use new WC highlights API (from xemlaibongda.top JSON API)
|
| 117 |
const[wc,fr]=await Promise.all([
|
| 118 |
+
fetch('/api/wc2026/highlights').then(r=>r.json()).catch(()=>[]),
|
| 119 |
fetch('/api/highlights/friendly').then(r=>r.json()).catch(()=>[])
|
| 120 |
]);
|
| 121 |
+
const wcArr = Array.isArray(wc)?wc:[];
|
| 122 |
+
const frArr = Array.isArray(fr)?fr:[];
|
| 123 |
+
const all=[...wcArr.map((v,j)=>({...v,_league:'WC',_li:j})),...frArr.map((v,j)=>({...v,_league:'Friendly',_li:j}))];
|
| 124 |
+
if(!all.length){el.innerHTML='<div class="loading">Chưa có highlight World Cup</div>';return;}
|
| 125 |
+
let h='<div style="font-size:10px;color:#6a9fca;text-align:center;padding:3px">🎬 Khoảnh khắc World Cup 2026 · xemlaibongda.top</div>';
|
| 126 |
+
h+='<div style="display:grid;grid-template-columns:repeat(2,1fr);gap:6px;max-height:450px;overflow-y:auto;padding:4px">';
|
| 127 |
+
all.slice(0,30).forEach((v,i)=>{
|
| 128 |
const league=v._league==='WC'?'world-cup':'friendly';
|
| 129 |
+
const badge=v._league==='WC'?'🌍 WC':'🤝';
|
| 130 |
+
const clickUrl = v.link || (v.src ? v.src : '');
|
| 131 |
+
h+=`<div style="cursor:pointer;border-radius:6px;overflow:hidden;background:#0a1520" onclick="openHighlightFeed('${league}',${v._li},'${esc(clickUrl)}')">`;
|
| 132 |
h+=`<div style="position:relative;aspect-ratio:16/9;background:#1a2a3a">${v.img?`<img src="${esc(v.img)}" style="width:100%;height:100%;object-fit:cover">`:''}<div class="card-play">▶</div></div>`;
|
| 133 |
h+=`<div style="padding:4px 6px"><span style="font-size:8px;color:#f0c040">${badge}</span><div style="font-size:10px;color:#ccc;line-height:1.2;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden">${esc(v.title)}</div></div>`;
|
| 134 |
h+='</div>';
|