Add alert for new set

This commit is contained in:
2023-11-09 19:21:51 +01:00
parent fddb69619d
commit 2d3213ccd3
2 changed files with 33 additions and 1 deletions

View File

@@ -117,4 +117,36 @@ function startMatchAlert(match){
});
}
setTimeout(deleteAlert, 5000, `${match.id}${match.point1}_${match.point2}`)
}
function newSetAlert(match){
let alertsContainer = document.querySelector('body #alertsContainer');
let alert = `
<div id="${match.id}${match.point1}_${match.point2}" class="alert alert-info alert-dismissible fade show" role="alert">
<div class="d-flex align-items-center justify-content-between">
<h4 class="alert-heading d-inline-flex align-items-center"><span class="material-symbols-outlined">
scoreboard
</span>NOUVEAU SET !</h4>
<h4>${match.point1} - ${match.point2}</h4>
<h5>${match.set1} - ${match.set2}</h5>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<p>Le set ${match.set} entre ${match.expand.team1.name} et ${match.expand.team2.name} en ${match.expand.sport.name} vient de commencer !</p>
<hr>
<div class="d-flex align-items-center justify-content-between">
<p class="mb-0 d-inline-flex align-items-center">${getSportIconHTML(match.expand.sport.name)}${match.expand.sport.name}</p>
<p class="mb-0">${match.expand.team1.name}</p>
<b><p class="mb-0">${match.point1} - ${match.point2}</p></b>
<p class="mb-0">${match.expand.team2.name}</p>
</div>
</div>
`
alertsContainer.insertAdjacentHTML("beforeend", alert);
//Send a notification to the client if the browser supports it
if (Notification.permission === "granted") {
let notification = new Notification(`${match.expand.team1.name} - ${match.expand.team2.name}`, {
body: `${match.point1} - ${match.point2}`,
});
}
setTimeout(deleteAlert, 5000, `${match.id}${match.point1}_${match.point2}`)
}

View File

@@ -400,7 +400,7 @@ if(window.location.href.includes("arbitrage.html")){
//Affichage des matchs sur la page d'accueil
//Elle s'appele indox.html ou bien n'as pas d'autre juste /
if(window.location.href.includes("index.html") || window.location.href === "https://interpromo.appen.fr/"){
if(window.location.href.includes("index.html") || window.location.href === "https://interpromo.appen.fr"){
//Affichage des matchs
matchList.forEach(match => {
let container = document.getElementById('cardContainer');