Spaces:
Runtime error
Runtime error
Fix white boxes: force dark bg on all elements, hide broken images, remove inline white styles"
Browse files- static/wc2026_v2.js +28 -22
static/wc2026_v2.js
CHANGED
|
@@ -1,35 +1,32 @@
|
|
| 1 |
// === WORLD CUP 2026 - Render + LIVE refresh ===
|
| 2 |
-
// Fixtures: scraped from bongda24h.vn (server-rendered)
|
| 3 |
-
// BXH: bongda.com.vn API tournament_id=24254
|
| 4 |
-
// News: VnExpress + TT&VH + BongDaPlus
|
| 5 |
-
|
| 6 |
let _wc2026Data = null;
|
| 7 |
let _wcRefreshInterval = null;
|
| 8 |
|
| 9 |
const WC_CSS = `<style>
|
| 10 |
-
.wc-bongda-content{font-size:12px;color:#ddd;max-height:420px;overflow-y:auto;padding:4px}
|
| 11 |
-
.wc-bongda-content
|
| 12 |
.wc-bongda-content a{color:#8ab4d8!important;text-decoration:none!important}
|
| 13 |
-
.wc-bongda-content table{width:100%;border-collapse:collapse;font-size:11px}
|
| 14 |
.wc-bongda-content th{background:#0d1a2a!important;color:#6a9fca!important;padding:6px 4px;font-size:10px;text-align:left}
|
| 15 |
-
.wc-bongda-content td{padding:5px 4px;border-bottom:1px solid #
|
| 16 |
.wc-bongda-content tr:hover td{background:#0d1a2a!important}
|
| 17 |
-
.wc-bongda-content img{width:20px;height:20px;vertical-align:middle;margin:0 3px}
|
|
|
|
| 18 |
.wc-bongda-content ul{list-style:none;padding:0;margin:0}
|
| 19 |
-
.wc-bongda-content li{padding:6px 4px;border-bottom:1px solid #1a2a3a}
|
| 20 |
.wc-bongda-content li:hover{background:#0d1a2a!important}
|
| 21 |
-
.wc-bongda-content
|
| 22 |
-
.wc-bongda-content
|
| 23 |
-
.wc-bongda-content
|
| 24 |
-
.wc-bongda-content .
|
| 25 |
-
.wc-bongda-content .
|
| 26 |
-
.wc-bongda-content .
|
| 27 |
-
.wc-bongda-content .status,.wc-bongda-content .score
|
| 28 |
-
.wc-bongda-content .
|
| 29 |
-
.wc-bongda-content
|
| 30 |
-
.wc-bongda-content
|
| 31 |
-
.wc-bongda-content
|
| 32 |
-
.wc-bongda-content .
|
| 33 |
</style>`;
|
| 34 |
|
| 35 |
function switchWCTab(tab) {
|
|
@@ -51,7 +48,16 @@ function switchWCTab(tab) {
|
|
| 51 |
|
| 52 |
function _wcRender(el, html, emptyMsg) {
|
| 53 |
if (html && html.length > 50) {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
el.innerHTML = WC_CSS + '<div class="wc-bongda-content">' + html + '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
el.querySelectorAll('a').forEach(a => a.addEventListener('click', e => e.preventDefault()));
|
| 56 |
} else {
|
| 57 |
el.innerHTML = `<div class="loading">${emptyMsg}</div>`;
|
|
|
|
| 1 |
// === WORLD CUP 2026 - Render + LIVE refresh ===
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
let _wc2026Data = null;
|
| 3 |
let _wcRefreshInterval = null;
|
| 4 |
|
| 5 |
const WC_CSS = `<style>
|
| 6 |
+
.wc-bongda-content{font-size:12px;color:#ddd;max-height:420px;overflow-y:auto;padding:4px;background:#111!important}
|
| 7 |
+
.wc-bongda-content *{color:#ddd!important;background-color:#111!important;border-color:#1a3a5a!important;box-shadow:none!important}
|
| 8 |
.wc-bongda-content a{color:#8ab4d8!important;text-decoration:none!important}
|
| 9 |
+
.wc-bongda-content table{width:100%;border-collapse:collapse;font-size:11px;background:#111!important}
|
| 10 |
.wc-bongda-content th{background:#0d1a2a!important;color:#6a9fca!important;padding:6px 4px;font-size:10px;text-align:left}
|
| 11 |
+
.wc-bongda-content td{padding:5px 4px;border-bottom:1px solid #1a2a3a!important;background:#111!important}
|
| 12 |
.wc-bongda-content tr:hover td{background:#0d1a2a!important}
|
| 13 |
+
.wc-bongda-content img{width:20px;height:20px;vertical-align:middle;margin:0 3px;background:transparent!important}
|
| 14 |
+
.wc-bongda-content img[src=""]{display:none!important}
|
| 15 |
.wc-bongda-content ul{list-style:none;padding:0;margin:0}
|
| 16 |
+
.wc-bongda-content li{padding:6px 4px;border-bottom:1px solid #1a2a3a;background:#111!important}
|
| 17 |
.wc-bongda-content li:hover{background:#0d1a2a!important}
|
| 18 |
+
.wc-bongda-content div{background:#111!important}
|
| 19 |
+
.wc-bongda-content span{background:transparent!important}
|
| 20 |
+
.wc-bongda-content p{background:#111!important}
|
| 21 |
+
.wc-bongda-content .title-content,.wc-bongda-content .round-title,.wc-bongda-content h3,.wc-bongda-content h4,.wc-bongda-content .group-name,.wc-bongda-content [class*=title],.wc-bongda-content [class*=round],.wc-bongda-content [class*=header]{background:#0b2040!important;color:#8ab4d8!important;font-size:12px;font-weight:700;padding:6px 8px;border-radius:4px;margin:6px 0 4px}
|
| 22 |
+
.wc-bongda-content .match,.wc-bongda-content .match-item,.wc-bongda-content .item-schedule,.wc-bongda-content [class*=match]{padding:5px 4px;border-bottom:1px solid #0d1a2a}
|
| 23 |
+
.wc-bongda-content .team,.wc-bongda-content [class*=team]{background:transparent!important}
|
| 24 |
+
.wc-bongda-content .status,.wc-bongda-content .score,.wc-bongda-content [class*=score]{text-align:center;font-weight:800;color:#fff!important;background:transparent!important}
|
| 25 |
+
.wc-bongda-content .info,.wc-bongda-content .btns,.wc-bongda-content .ads,.wc-bongda-content .banner,.wc-bongda-content [class*=ads],.wc-bongda-content [class*=banner],.wc-bongda-content [class*=social],.wc-bongda-content [class*=share]{display:none!important}
|
| 26 |
+
.wc-bongda-content strong,.wc-bongda-content b{color:#f0c040!important;background:transparent!important}
|
| 27 |
+
.wc-bongda-content [class*=time],.wc-bongda-content [class*=date]{font-size:10px;color:#6a9fca!important}
|
| 28 |
+
.wc-bongda-content [class*=live]{color:#e74c3c!important}
|
| 29 |
+
.wc-bongda-content input,.wc-bongda-content select,.wc-bongda-content button{background:#1a2a3a!important;color:#ddd!important;border:1px solid #2a3a5a!important;border-radius:4px;padding:4px 8px;font-size:11px}
|
| 30 |
</style>`;
|
| 31 |
|
| 32 |
function switchWCTab(tab) {
|
|
|
|
| 48 |
|
| 49 |
function _wcRender(el, html, emptyMsg) {
|
| 50 |
if (html && html.length > 50) {
|
| 51 |
+
// Strip inline style attributes that set white/light backgrounds
|
| 52 |
+
html = html.replace(/style="[^"]*background[^"]*"/gi, '');
|
| 53 |
+
html = html.replace(/style="[^"]*color:\s*#[0-3][^"]*"/gi, '');
|
| 54 |
+
html = html.replace(/bgcolor="[^"]*"/gi, '');
|
| 55 |
el.innerHTML = WC_CSS + '<div class="wc-bongda-content">' + html + '</div>';
|
| 56 |
+
// Remove broken images
|
| 57 |
+
el.querySelectorAll('img').forEach(img => {
|
| 58 |
+
img.onerror = function() { this.style.display = 'none'; };
|
| 59 |
+
if (!img.src || img.src === window.location.href) img.style.display = 'none';
|
| 60 |
+
});
|
| 61 |
el.querySelectorAll('a').forEach(a => a.addEventListener('click', e => e.preventDefault()));
|
| 62 |
} else {
|
| 63 |
el.innerHTML = `<div class="loading">${emptyMsg}</div>`;
|