bep40 commited on
Commit
3fc08ed
·
verified ·
1 Parent(s): 45cc0b8

Upload static/wc2026_v2.js with huggingface_hub

Browse files
Files changed (1) hide show
  1. 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 + Friendly from xemlaibongda.top) ===
113
  async function renderWCHighlights(el){
114
- el.innerHTML='<div class="loading">Đang tải highlight...</div>';
115
  try{
116
- // Load both WC and Friendly highlights
117
  const[wc,fr]=await Promise.all([
118
- fetch('/api/highlights/world-cup').then(r=>r.json()).catch(()=>[]),
119
  fetch('/api/highlights/friendly').then(r=>r.json()).catch(()=>[])
120
  ]);
121
- // Keep per-league index so the clicked card maps to the correct video in its own league array
122
- const all=[...(wc||[]).map((v,j)=>({...v,_league:'WC',_li:j})),...(fr||[]).map((v,j)=>({...v,_league:'Friendly',_li:j}))];
123
- if(!all.length){el.innerHTML='<div class="loading">Chưa có highlight World Cup & Giao hữu</div>';return;}
124
- let h='<div style="display:grid;grid-template-columns:repeat(2,1fr);gap:6px;max-height:450px;overflow-y:auto;padding:4px">';
125
- all.slice(0,24).forEach((v,i)=>{
 
 
126
  const league=v._league==='WC'?'world-cup':'friendly';
127
- const badge=v._league==='WC'?'🌍 WC':'🤝 Friendly';
128
- h+=`<div style="cursor:pointer;border-radius:6px;overflow:hidden;background:#0a1520" onclick="openHighlightFeed('${league}',${v._li},'${esc(v.link)}')">`;
 
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>';