document.addEventListener("DOMContentLoaded", function () {
const productForm = document.querySelector('.form.product-form');
if(productForm){
const fomoHTML = `
`;
productForm.insertAdjacentHTML("afterbegin", fomoHTML);
let currentViewers = 42;
let currentBuyers = 12;
function glow(el){
el.classList.add("gold-glow");
el.classList.add("pulse-gold");
setTimeout(() => {
el.classList.remove("gold-glow");
el.classList.remove("pulse-gold");
},800);
}
function updateViewers(){
currentViewers += Math.floor(Math.random() * 5) - 2;
if(currentViewers < 30) currentViewers = 30;
if(currentViewers > 50) currentViewers = 50;
const viewersEl = document.querySelector(".viewers-count");
viewersEl.innerText = currentViewers;
glow(viewersEl);
}
function updateBuyers(){
currentBuyers += Math.floor(Math.random() * 3) - 1;
if(currentBuyers < 9) currentBuyers = 9;
if(currentBuyers > 15) currentBuyers = 19;
const buyersEl = document.querySelector(".buyers-count");
buyersEl.innerText = currentBuyers;
glow(buyersEl);
}
updateViewers();
updateBuyers();
setInterval(updateViewers,5000);
setInterval(updateBuyers,12000);
}
});