Spaces:
Running
Running
Fix: static/wc2026_v2.js (CSS rewrite/AI-wall, WC2026 BXH, highlight selection)
Browse files- static/wc2026_v2.js +45 -4
static/wc2026_v2.js
CHANGED
|
@@ -3,7 +3,32 @@ let _wc2026Data=null;let _wcRefreshInterval=null;
|
|
| 3 |
const WC_TEAMS={'Mexico':'🇲🇽 Mexico','Colombia':'🇨🇴 Colombia','USA':'🇺🇸 Mỹ','United States':'🇺🇸 Mỹ','Brazil':'🇧🇷 Brazil','Argentina':'🇦🇷 Argentina','Germany':'🇩🇪 Đức','France':'🇫🇷 Pháp','Spain':'🇪🇸 Tây Ban Nha','England':'🏴 Anh','Portugal':'🇵🇹 Bồ Đào Nha','Netherlands':'🇳🇱 Hà Lan','Italy':'🇮🇹 Ý','Belgium':'🇧🇪 Bỉ','Croatia':'🇭🇷 Croatia','Uruguay':'🇺🇾 Uruguay','Japan':'🇯🇵 Nhật Bản','South Korea':'🇰🇷 Hàn Quốc','Korea Republic':'🇰🇷 Hàn Quốc','Australia':'🇦🇺 Úc','Saudi Arabia':'🇸🇦 Ả Rập Xê Út','Iran':'🇮🇷 Iran','Qatar':'🇶🇦 Qatar','Canada':'🇨🇦 Canada','Morocco':'🇲🇦 Morocco','Senegal':'🇸🇳 Senegal','Ecuador':'🇪🇨 Ecuador','Serbia':'🇷🇸 Serbia','Switzerland':'🇨🇭 Thụy Sĩ','Denmark':'🇩🇰 Đan Mạch','Poland':'🇵🇱 Ba Lan','Turkey':'🇹🇷 Thổ Nhĩ Kỳ','Türkiye':'🇹🇷 Thổ Nhĩ Kỳ','Ukraine':'🇺🇦 Ukraine','Egypt':'🇪🇬 Ai Cập','Nigeria':'🇳🇬 Nigeria','Cameroon':'🇨🇲 Cameroon','Ghana':'🇬🇭 Ghana','Tunisia':'🇹🇳 Tunisia','Algeria':'🇩🇿 Algeria','South Africa':'🇿🇦 Nam Phi','Indonesia':'🇮🇩 Indonesia','Vietnam':'🇻🇳 Việt Nam','China PR':'🇨🇳 Trung Quốc','New Zealand':'🇳🇿 New Zealand','Panama':'🇵🇦 Panama','Costa Rica':'🇨🇷 Costa Rica','Jamaica':'🇯🇲 Jamaica','Honduras':'🇭🇳 Honduras','Paraguay':'🇵🇾 Paraguay','Bolivia':'🇧🇴 Bolivia','Chile':'🇨🇱 Chile','Peru':'🇵🇪 Peru','Venezuela':'🇻🇪 Venezuela','Norway':'🇳🇴 Na Uy','Sweden':'🇸🇪 Thụy Điển','Austria':'🇦🇹 Áo','Scotland':'🏴 Scotland','Wales':'🏴 Xứ Wales','Ireland':'🇮🇪 Ireland','Romania':'🇷🇴 Romania','Hungary':'🇭🇺 Hungary','Greece':'🇬🇷 Hy Lạp','Uzbekistan':'🇺🇿 Uzbekistan','Iraq':'🇮🇶 Iraq','TBD':'🏳️ TBD'};
|
| 4 |
function _t(n){return WC_TEAMS[n]||WC_TEAMS[(n||'').trim()]||'🏴 '+n;}
|
| 5 |
|
| 6 |
-
const WC_CSS=`<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
function switchWCTab(tab){
|
| 9 |
document.querySelectorAll('.wc-tab').forEach(t=>t.classList.remove('active'));
|
|
@@ -51,7 +76,22 @@ function renderWCFixtures(el){
|
|
| 51 |
// === BXH ===
|
| 52 |
function renderWCStandings(el){
|
| 53 |
const d=_wc2026Data.standings||{};
|
| 54 |
-
if(d.html&&d.html.length>100){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
// Self-calculate from fixtures
|
| 56 |
const fx=_wc2026Data.fixtures||{};const matches=fx.matches||[];
|
| 57 |
const gm=matches.filter(m=>m.group&&m.group.toLowerCase().includes('group'));
|
|
@@ -78,13 +118,14 @@ async function renderWCHighlights(el){
|
|
| 78 |
fetch('/api/highlights/world-cup').then(r=>r.json()).catch(()=>[]),
|
| 79 |
fetch('/api/highlights/friendly').then(r=>r.json()).catch(()=>[])
|
| 80 |
]);
|
| 81 |
-
|
|
|
|
| 82 |
if(!all.length){el.innerHTML='<div class="loading">Chưa có highlight World Cup & Giao hữu</div>';return;}
|
| 83 |
let h='<div style="display:grid;grid-template-columns:repeat(2,1fr);gap:6px;max-height:450px;overflow-y:auto;padding:4px">';
|
| 84 |
all.slice(0,24).forEach((v,i)=>{
|
| 85 |
const league=v._league==='WC'?'world-cup':'friendly';
|
| 86 |
const badge=v._league==='WC'?'🌍 WC':'🤝 Friendly';
|
| 87 |
-
h+=`<div style="cursor:pointer;border-radius:6px;overflow:hidden;background:#0a1520" onclick="openHighlightFeed('${league}',${
|
| 88 |
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>`;
|
| 89 |
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>`;
|
| 90 |
h+='</div>';
|
|
|
|
| 3 |
const WC_TEAMS={'Mexico':'🇲🇽 Mexico','Colombia':'🇨🇴 Colombia','USA':'🇺🇸 Mỹ','United States':'🇺🇸 Mỹ','Brazil':'🇧🇷 Brazil','Argentina':'🇦🇷 Argentina','Germany':'🇩🇪 Đức','France':'🇫🇷 Pháp','Spain':'🇪🇸 Tây Ban Nha','England':'🏴 Anh','Portugal':'🇵🇹 Bồ Đào Nha','Netherlands':'🇳🇱 Hà Lan','Italy':'🇮🇹 Ý','Belgium':'🇧🇪 Bỉ','Croatia':'🇭🇷 Croatia','Uruguay':'🇺🇾 Uruguay','Japan':'🇯🇵 Nhật Bản','South Korea':'🇰🇷 Hàn Quốc','Korea Republic':'🇰🇷 Hàn Quốc','Australia':'🇦🇺 Úc','Saudi Arabia':'🇸🇦 Ả Rập Xê Út','Iran':'🇮🇷 Iran','Qatar':'🇶🇦 Qatar','Canada':'🇨🇦 Canada','Morocco':'🇲🇦 Morocco','Senegal':'🇸🇳 Senegal','Ecuador':'🇪🇨 Ecuador','Serbia':'🇷🇸 Serbia','Switzerland':'🇨🇭 Thụy Sĩ','Denmark':'🇩🇰 Đan Mạch','Poland':'🇵🇱 Ba Lan','Turkey':'🇹🇷 Thổ Nhĩ Kỳ','Türkiye':'🇹🇷 Thổ Nhĩ Kỳ','Ukraine':'🇺🇦 Ukraine','Egypt':'🇪🇬 Ai Cập','Nigeria':'🇳🇬 Nigeria','Cameroon':'🇨🇲 Cameroon','Ghana':'🇬🇭 Ghana','Tunisia':'🇹🇳 Tunisia','Algeria':'🇩🇿 Algeria','South Africa':'🇿🇦 Nam Phi','Indonesia':'🇮🇩 Indonesia','Vietnam':'🇻🇳 Việt Nam','China PR':'🇨🇳 Trung Quốc','New Zealand':'🇳🇿 New Zealand','Panama':'🇵🇦 Panama','Costa Rica':'🇨🇷 Costa Rica','Jamaica':'🇯🇲 Jamaica','Honduras':'🇭🇳 Honduras','Paraguay':'🇵🇾 Paraguay','Bolivia':'🇧🇴 Bolivia','Chile':'🇨🇱 Chile','Peru':'🇵🇪 Peru','Venezuela':'🇻🇪 Venezuela','Norway':'🇳🇴 Na Uy','Sweden':'🇸🇪 Thụy Điển','Austria':'🇦🇹 Áo','Scotland':'🏴 Scotland','Wales':'🏴 Xứ Wales','Ireland':'🇮🇪 Ireland','Romania':'🇷🇴 Romania','Hungary':'🇭🇺 Hungary','Greece':'🇬🇷 Hy Lạp','Uzbekistan':'🇺🇿 Uzbekistan','Iraq':'🇮🇶 Iraq','TBD':'🏳️ TBD'};
|
| 4 |
function _t(n){return WC_TEAMS[n]||WC_TEAMS[(n||'').trim()]||'🏴 '+n;}
|
| 5 |
|
| 6 |
+
const WC_CSS=`<style>
|
| 7 |
+
.wc-bxh{max-height:460px;overflow-y:auto;padding:2px;display:block}
|
| 8 |
+
.wc-bxh,.wc-bxh *{box-sizing:border-box!important;float:none!important;max-width:100%!important}
|
| 9 |
+
.wc-bxh script,.wc-bxh style,.wc-bxh ins,.wc-bxh iframe,.wc-bxh .info,.wc-bxh .btns,.wc-bxh .form{display:none!important}
|
| 10 |
+
.wc-bxh .title-table,.wc-bxh h6{display:block!important;background:#0b1a2a!important;color:#f0c040!important;font-size:11px!important;font-weight:800!important;padding:6px 8px!important;margin:8px 0 0!important;border-radius:5px 5px 0 0!important;border-bottom:1px solid #1a3a5a!important}
|
| 11 |
+
.wc-bxh .bxh-head{display:flex!important;align-items:center!important;padding:4px 6px!important;background:#0a1320!important;color:#6a9fca!important;font-size:9px!important;font-weight:700!important;border-bottom:1px solid #1a3a5a!important}
|
| 12 |
+
.wc-bxh .bxh-head .h-team{flex:1!important;text-align:left!important}
|
| 13 |
+
.wc-bxh .bxh-head .h-stat{flex:0 0 26px!important;text-align:center!important}
|
| 14 |
+
.wc-bxh .bxh-head .h-pts{flex:0 0 30px!important;text-align:center!important;color:#f0c040!important}
|
| 15 |
+
.wc-bxh .item{display:flex!important;align-items:center!important;padding:5px 6px!important;border-bottom:1px solid #10202f!important;background:transparent!important}
|
| 16 |
+
.wc-bxh .item:nth-child(even){background:#0a1320!important}
|
| 17 |
+
.wc-bxh .item .team{flex:1!important;display:flex!important;align-items:center!important;gap:5px!important;min-width:0!important;text-align:left!important}
|
| 18 |
+
.wc-bxh .item .team>span{flex:0 0 16px!important;color:#6a9fca!important;font-size:10px!important;text-align:center!important}
|
| 19 |
+
.wc-bxh .item .team a{flex:1!important;display:flex!important;align-items:center!important;gap:5px!important;min-width:0!important;color:#eee!important;text-decoration:none!important}
|
| 20 |
+
.wc-bxh .item .team a p{font-size:11px!important;color:#eee!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;margin:0!important}
|
| 21 |
+
.wc-bxh .item .copy{display:flex!important;align-items:center!important;flex:0 0 auto!important}
|
| 22 |
+
.wc-bxh .item .copy>p{flex:0 0 26px!important;text-align:center!important;font-size:10px!important;color:#ccc!important;margin:0!important}
|
| 23 |
+
.wc-bxh .item .copy>p:last-of-type,.wc-bxh .item .copy>p:nth-last-child(2){flex:0 0 30px!important}
|
| 24 |
+
.wc-bxh .item .copy>p strong{color:#f0c040!important;font-weight:800!important}
|
| 25 |
+
.wc-bxh img{width:18px!important;height:18px!important;object-fit:contain!important;vertical-align:middle!important;display:inline-block!important;flex:0 0 18px!important}
|
| 26 |
+
.wc-bxh strong{color:#f0c040!important}
|
| 27 |
+
.wc-bxh a{color:#8ab4d8!important;text-decoration:none!important}
|
| 28 |
+
.wc-bxh table{width:100%!important;border-collapse:collapse!important;font-size:11px!important;display:table!important}
|
| 29 |
+
.wc-bxh th{background:#0b1a2a!important;color:#6a9fca!important;padding:5px 3px!important;font-size:9px!important;text-align:center!important}
|
| 30 |
+
.wc-bxh td{padding:4px 3px!important;border-bottom:1px solid #0d1a2a!important;font-size:10px!important;color:#ddd!important}
|
| 31 |
+
</style>`;
|
| 32 |
|
| 33 |
function switchWCTab(tab){
|
| 34 |
document.querySelectorAll('.wc-tab').forEach(t=>t.classList.remove('active'));
|
|
|
|
| 76 |
// === BXH ===
|
| 77 |
function renderWCStandings(el){
|
| 78 |
const d=_wc2026Data.standings||{};
|
| 79 |
+
if(d.html&&d.html.length>100){
|
| 80 |
+
el.innerHTML=WC_CSS+'<div class="wc-bxh">'+d.html+'</div>';
|
| 81 |
+
const box=el.querySelector('.wc-bxh');
|
| 82 |
+
if(box){
|
| 83 |
+
// Insert a column-header row right after each group title so stats are labeled
|
| 84 |
+
box.querySelectorAll('.title-table, h6').forEach(t=>{
|
| 85 |
+
if(t.nextElementSibling && t.nextElementSibling.classList.contains('bxh-head'))return;
|
| 86 |
+
const head=document.createElement('div');
|
| 87 |
+
head.className='bxh-head';
|
| 88 |
+
head.innerHTML='<span class="h-team">Đội</span><span class="h-stat">Tr</span><span class="h-stat">T</span><span class="h-stat">H</span><span class="h-stat">B</span><span class="h-stat">BT</span><span class="h-stat">BB</span><span class="h-pts">HS</span><span class="h-pts">Đ</span>';
|
| 89 |
+
t.insertAdjacentElement('afterend',head);
|
| 90 |
+
});
|
| 91 |
+
}
|
| 92 |
+
el.querySelectorAll('a').forEach(a=>a.addEventListener('click',e=>e.preventDefault()));
|
| 93 |
+
return;
|
| 94 |
+
}
|
| 95 |
// Self-calculate from fixtures
|
| 96 |
const fx=_wc2026Data.fixtures||{};const matches=fx.matches||[];
|
| 97 |
const gm=matches.filter(m=>m.group&&m.group.toLowerCase().includes('group'));
|
|
|
|
| 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>';
|