[    [    [    [    [    [    [    b l o g g i n   s p a c e    wiki   ]    ]    ]    ]    ]    ]    ]

Difference between revisions of "Football"

From blogginpedia
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>


<iframe
<div id="lotus-links" style="font-family: Arial, sans-serif; padding: 10px; max-width: 100%;"></div>
  id="lotus-iframe"
  src="https://lotusgamehd.xyz/api-event.php"
  width="100%"
  height="0"
  style="border:none; height:0; overflow:hidden;"
  onload="renderLotusLinks(this)"
></iframe>


<script>
<script>
function renderLotusLinks(iframe) {
document.addEventListener('DOMContentLoaded', function() {
  // Step 1: Extract raw JSON from iframe
   const container = document.getElementById('lotus-links');
   const doc = iframe.contentDocument || iframe.contentWindow.document;
   container.innerHTML = '<p>Loading streams...</p>'; // Show loading
  const pre = doc.body.querySelector('pre');
   if (!pre) {
    iframe.before('<p style="color:red">Failed to load data.</p>');
    iframe.remove();
    return;
  }


   let data;
   fetch('https://lotusgamehd.xyz/api-event.php')
  try {
    .then(response => {
    data = JSON.parse(pre.textContent);
      if (!response.ok) throw new Error('API unavailable');
  } catch (e) {
      return response.json();
     iframe.before('<p style="color:red">Invalid JSON.</p>');
    })
    iframe.remove();
     .then(data => {
    return;
      if (!data.days || data.days.length === 0) throw new Error('No events found');
  }


  // Step 2: Extract only stream links
      // Extract stream links only
  const links = [];
      const links = [];
  data.days.forEach(day => {
      data.days.forEach(day => {
    day.items.forEach(event => {
        day.items.forEach(event => {
      if (event.streams && event.streams[0]?.link) {
          if (event.streams && event.streams.length > 0) {
        links.push({
            const stream = event.streams[0]; // First stream
          url: event.streams[0].link,
            links.push({
          title: event.title,
              url: stream.link,
          league: (event.league || '').toUpperCase(),
              title: event.title,
          time: event.when_et?.split(' ')[1] || '',
              league: (event.league || 'Unknown').toUpperCase(),
          live: event.status === 'LIVE'
              time: event.when_et ? event.when_et.split(' ')[1] : '', // e.g., "20:20"
              status: event.status === 'LIVE' ? '🔴 LIVE' : '⏰ UPCOMING'
            });
          }
         });
         });
      });
      if (links.length === 0) {
        container.innerHTML = '<p style="color: orange;">No streams available right now.</p>';
        return;
       }
       }
    });
  });


  if (links.length === 0) {
      // Sort: LIVE first
    iframe.before('<p>No streams available.</p>');
      links.sort((a, b) => (b.status.includes('LIVE') ? 1 : 0) - (a.status.includes('LIVE') ? 1 : 0));
    iframe.remove();
    return;
  }


  // Step 3: Sort: LIVE first
      // Render as responsive cards
  links.sort((a, b) => b.live - a.live);
      container.innerHTML = `
 
        <h3 style="margin: 0 0 10px 0; color: #333;">🔗 Active Streams (${links.length})</h3>
  // Step 4: Build clean link list
        <div style="display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));">
  const container = document.createElement('div');
          ${links.map(link => `
  container.innerHTML = `
            <a href="${link.url}" target="_blank" rel="noopener"
    <h3>Live & Upcoming Streams <small>(${links.length})</small></h3>
              style="display: block; padding: 12px; background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);  
    <div style="display:grid; gap:8px; grid-template-columns:repeat(auto-fill,minmax(260px,1fr));">
                      border: 1px solid #dee2e6; border-radius: 8px; text-decoration: none;  
      ${links.map(l => `
                      color: #212529; font-weight: 500; transition: box-shadow 0.2s;
        <a href="${l.url}" target="_blank"
                      box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
          style="display:block; padding:12px; background:#f8f9fa; border:1px solid #ddd;  
              <div style="font-size: 0.85em; color: #6c757d; margin-bottom: 4px;">
                  border-radius:8px; text-decoration:none; color:#1a0dab; font-weight:500;">
                ${link.status} ${link.league} • ${link.time}
          <div style="font-size:0.9em; color:#555;">
              </div>
            ${l.live ? 'LIVE' : 'UPCOMING'} ${l.league} • ${l.time}
              <div style="font-size: 1em; color: #212529;">${link.title}</div>
          </div>
            </a>
          <div style="margin-top:4px; font-weight:bold;">${l.title}</div>
          `).join('')}
        </a>
        </div>
      `).join('')}
        <p style="font-size: 0.8em; color: #6c757d; margin-top: 15px; text-align: right;">
    </div>
          Updated: ${new Date().toLocaleString('en-US', { timeZone: 'America/New_York', hour12: true })} ET
    <p style="font-size:0.8em; color:#666; margin-top:12px;">
        </p>
      Updated: ${new Date().toLocaleString('en-CA', { timeZone: 'America/Toronto' })}
      `;
    </p>
    })
  `;
    .catch(error => {
 
      console.error('Fetch error:', error); // For debugging
  // Step 5: Replace iframe with links
      container.innerHTML = `<p style="color: red;">Failed to load streams: ${error.message}.
  iframe.before(container);
                              <br><small>Check console (F12) for details or try refreshing.</small></p>`;
  iframe.remove();
    });
}
});
</script>
</script>


</html>
</html>
[[Category:Sports]][[Category:Video]]
[[Category:Sports]][[Category:Video]]

Revision as of 00:35, 17 November 2025