Difference between revisions of "Football"
Jump to navigation
Jump to search
| Line 2: | Line 2: | ||
<iframe src="https://lotusgamehd.xyz/lotushd.php?hd=260" width="81%" height="500" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" allowfullscreen="yes"></iframe> | <iframe src="https://lotusgamehd.xyz/lotushd.php?hd=260" width="81%" height="500" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" allowfullscreen="yes"></iframe> | ||
<div id="lotus- | <div id="lotus-streams">Loading streams...</div> | ||
<script> | <script> | ||
document. | // Step 1: Fetch JSON as plain text (this works despite CORS for <script>) | ||
const | const script = document.createElement('script'); | ||
script.src = 'https://lotusgamehd.xyz/api-event.php'; | |||
script.onload = function() { | |||
// JSON loaded into global var (rename to avoid conflicts) | |||
const data = window.lotusJsonData; // Set in next step | |||
renderLinks(data); | |||
delete window.lotusJsonData; // Cleanup | |||
}; | |||
document.head.appendChild(script); | |||
// Step 2: Alternative if script fails — use data URL iframe (base64 proxy) | |||
const fallbackIframe = document.createElement('iframe'); | |||
fallbackIframe.id = 'lotus-fallback'; | |||
fallbackIframe.style.display = 'none'; | |||
document.body.appendChild(fallbackIframe); | |||
setTimeout(() => { | |||
if (!window.lotusJsonData) { | |||
// Fetch as text for base64 | |||
fetch('https://lotusgamehd.xyz/api-event.php') | |||
.then(r => r.text()) | |||
.then(text => { | |||
const encoded = btoa(unescape(encodeURIComponent(text))); // UTF-8 safe base64 | |||
fallbackIframe.src = 'data:text/html;base64,' + encoded; | |||
fallbackIframe.onload = () => { | |||
const doc = fallbackIframe.contentDocument; | |||
const jsonText = doc.body.textContent; | |||
const data = JSON.parse(jsonText); | |||
renderLinks(data); | |||
fallbackIframe.remove(); | |||
}; | |||
}) | |||
.catch(() => { | |||
document.getElementById('lotus-streams').innerHTML = '<p style="color:red;">Both methods failed — try incognito or disable adblocker.</p>'; | |||
}); | }); | ||
} | |||
}, 1000); // Give script time | |||
// Step 3: Common render function | |||
function renderLinks(data) { | |||
const output = document.getElementById('lotus-streams'); | |||
if (!data || !data.days) { | |||
output.innerHTML = '<p style="color:orange;">No events found.</p>'; | |||
return; | |||
} | |||
// Extract links | |||
const links = []; | |||
data.days.forEach(day => { | |||
day.items.forEach(event => { | |||
if (event.streams?.[0]?.link) { | |||
links.push({ | |||
url: event.streams[0].link, | |||
title: event.title, | |||
league: (event.league || 'Unknown').toUpperCase(), | |||
time: event.when_et ? event.when_et.split(' ')[1] : '', | |||
status: event.status === 'LIVE' ? '🔴 LIVE' : '⏰ UPCOMING' | |||
}); | |||
} | } | ||
}); | |||
}); | |||
if (links.length === 0) { | |||
output.innerHTML = '<p>No streams available.</p>'; | |||
return; | |||
} | |||
// Sort LIVE first | |||
links.sort((a, b) => (b.status.includes('LIVE') ? 1 : 0) - (a.status.includes('LIVE') ? 1 : 0)); | |||
// Render cards | |||
output.innerHTML = ` | |||
<h3 style="color:#333; margin-bottom:10px;">🔗 Active Streams (${links.length})</h3> | |||
<div style="display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));"> | |||
${links.map(l => ` | |||
<a href="${l.url}" target="_blank" rel="noopener noreferrer" | |||
style="display: block; padding: 12px; background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%); | |||
border: 1px solid #b3d9ff; border-radius: 8px; text-decoration: none; | |||
color: #1e40af; font-weight: 500; box-shadow: 0 2px 8px rgba(0,0,0,0.1); | |||
transition: transform 0.2s, box-shadow 0.2s;"> | |||
<div style="font-size: 0.85em; color: #64748b; margin-bottom: 4px;"> | |||
${l.status} • ${l.league} • ${l.time} | |||
</div> | |||
<div style="font-size: 1em; color: #1e40af; font-weight: bold;">${l.title}</div> | |||
</a> | |||
`).join('')} | |||
</div> | |||
<p style="font-size: 0.8em; color: #94a3b8; margin-top: 15px; text-align: right;"> | |||
Updated: ${new Date().toLocaleString('en-US', { timeZone: 'America/New_York', hour12: true })} ET | |||
</p> | |||
`; | |||
} | |||
</script> | |||
<!-- Fallback: JSONP-like script tag to load data globally --> | |||
<script id="lotus-json-loader"> | |||
(function() { | |||
fetch('https://lotusgamehd.xyz/api-event.php') | |||
.then(r => r.text()) | |||
.then(text => { | |||
window.lotusJsonData = JSON.parse(text); | |||
}) | }) | ||
.catch( | .catch(() => {}); // Silent fail to fallback | ||
})(); | |||
</script> | </script> | ||
</html> | </html> | ||
[[Category:Sports]][[Category:Video]] | [[Category:Sports]][[Category:Video]] | ||
Revision as of 00:41, 17 November 2025
Loading streams...