<link rel="stylesheet" type="text/css" href="https://hd.la2zo.eu.org/styles.css">
<h1>Welcome to NFS Free!</h1>
<p>Top Box Office of Movies</p>

    <!-- Movies Table -->
    <table>
        <thead>
            <tr>
                <th>Genre</th>
                <th>Title</th>
                <th>Sub</th>
                <th>Link</th>
            </tr>
        </thead>
        <tbody id="movies"></tbody>
    </table>

    <script>
        const moviesApiUrl = 'https://api.codetabs.com/v1/proxy/?quest=https://hd.la2zo.eu.org/movies.json';

        async function fetchMovies() {
            try {
                const response = await fetch(moviesApiUrl);
                if (!response.ok) throw new Error('Failed to fetch movies');

                const movies = await response.json();
                const moviesTable = document.getElementById('movies');

                movies.forEach(movie => {
                    const row = document.createElement('tr');
                    row.innerHTML = `
                        <td>${movie.genre}</td>
                        <td>${movie.title}</td>
                        <td>${movie.sub}</td>
                        <td><a href='https://gn.nobar.eu.org/CLICK' onclick='javascript:window.open(&quot;${movie.link}&quot;)' target='_self'>${movie.watch}</a></td>
                    `;
                    moviesTable.appendChild(row);
                });
            } catch (error) {
                console.error('Error fetching movies:', error);
            }
        }

        fetchMovies();
    </script>

    <p>Schedule for today (GMT+7)</p>

    <!-- Schedule Table -->
    <table>
        <thead>
            <tr>
                <th>Time</th>
                <th>Event</th>
                <th>Teams</th>
                <th>Ch</th>
            </tr>
        </thead>
        <tbody id="schedule"></tbody>
    </table>

    <script>
        const scheduleApiUrl = 'https://api.codetabs.com/v1/proxy/?quest=https://nfsfree.wuaze.com/schedule.json';

        async function fetchSchedule() {
            try {
                const response = await fetch(scheduleApiUrl);
                if (!response.ok) throw new Error('Failed to fetch schedule');

                const schedule = await response.json();
                const scheduleTable = document.getElementById('schedule');

                schedule.forEach(event => {
                    const row = document.createElement('tr');
                    row.innerHTML = `
                        <td>${event.time}</td>
                        <td>${event.event}</td>
                        <td>${event.teams}</td>
                        <td><a href='https://gn.nobar.eu.org/CLICK' onclick='javascript:window.open(&quot;${event.link}&quot;)' target='_self'>${event.ch}</a></td>
                    `;
                    scheduleTable.appendChild(row);
                });
            } catch (error) {
                console.error('Error fetching schedule:', error);
            }
        }

        fetchSchedule();
    </script>