الدوري المصري الدوري الإنجليزي الدوري الإسباني الدوري الإيطالي الدوري الألماني الدوري الفرنسي جاري تحميل المباريات... #matches-app { max-width: 700px; margin: auto; font-family: Arial; } .top-bar { text-align: center; margin-bottom: 15px; } select { padding: 10px; border-radius: 8px; border: none; background: #0b1d3a; color: #fff; cursor: pointer; } .match { background: #0b1d3a; color: #fff; padding: 12px; margin: 10px 0; border-radius: 12px; } .teams { display: flex; justify-content: space-between; align-items: center; } .team { width: 40%; text-align: center; } .team img { width: 35px; height: 35px; } .score { font-size: 18px; font-weight: bold; } .date { font-size: 12px; opacity: 0.7; text-align: center; margin-top: 5px; } const API_KEY = "16e24add41393a5bb079f71bd3deeeac "; const select = document.getElementById("leagueSelect"); const container = document.getElementById("matches-container"); function loadMatches(leagueId) { container.innerHTML = "جاري التحميل..."; fetch("https://v3.football.api-sports.io/fixtures?league=" + leagueId + "&season=2024", { method: "GET", headers: { "x-apisports-key": API_KEY } }) .then(res => res.json()) .then(data => { let html = ""; if (!data.response || data.response.length === 0) { container.innerHTML = "لا توجد مباريات حالياً"; return; } data.response.slice(0, 15).forEach(match => { let home = match.teams.home; let away = match.teams.away; let score = match.goals.home !== null ? match.goals.home + " - " + match.goals.away : "vs"; let date = new Date(match.fixture.date).toLocaleString(); html += ` ${home.name} ${score} ${away.name} ${date} `; }); container.innerHTML = html; }) .catch(() => { container.innerHTML = "حصل خطأ في تحميل البيانات"; }); } select.addEventListener("change", function() { loadMatches(this.value); }); // تحميل أول دوري تلقائي loadMatches(select.value);