added time to fotbar and badge now auto refresh
This commit is contained in:
+22
-7
@@ -4,17 +4,22 @@ const motCaractere = document.getElementById("mot");
|
||||
const boutonEffacer = document.getElementById("effacer");
|
||||
const formulaire = document.querySelector("form");
|
||||
const badge = document.getElementById("statut_horaires");
|
||||
|
||||
const nom = document.getElementById("prenom");
|
||||
const heure = new Date().getHours();
|
||||
const MAX = 500;
|
||||
|
||||
if (heure >= 9 && heure < 18) {
|
||||
badge.textContent = "✅ Nous sommes ouverts (9h–18h)";
|
||||
badge.style.color = "green";
|
||||
} else {
|
||||
badge.textContent = "🔴 Fermé — écrivez-nous, on répond dès l'ouverture !";
|
||||
badge.style.color = "red";
|
||||
function rafraichir_badge() {
|
||||
const heure = new Date().getHours();
|
||||
|
||||
if (heure >= 9 && heure < 18) {
|
||||
badge.textContent = "✅ Nous sommes ouverts (9h–18h)";
|
||||
badge.style.color = "green";
|
||||
} else {
|
||||
badge.textContent = "🔴 Fermé — écrivez-nous, on répond dès l'ouverture !";
|
||||
badge.style.color = "red";
|
||||
}
|
||||
}
|
||||
setInterval(rafraichir_badge, 60);
|
||||
|
||||
function rafraichirCompteur() {
|
||||
const restant = MAX - zoneMessage.value.length;
|
||||
@@ -67,3 +72,13 @@ titres.forEach(function (titre) {
|
||||
reponse.classList.toggle("ouverte");
|
||||
});
|
||||
});
|
||||
|
||||
const horloge = document.getElementById("horloge");
|
||||
|
||||
function afficherHeure() {
|
||||
const maintenant = new Date();
|
||||
horloge.textContent = maintenant.toLocaleTimeString();
|
||||
}
|
||||
|
||||
afficherHeure();
|
||||
setInterval(afficherHeure, 1000);
|
||||
|
||||
Reference in New Issue
Block a user