document.querySelector("a").addEventListener("click", () => {
let timeLeft = 40;
const timer = document.getElementById("timer");
const earnBox = document.getElementById("earnBox");
const interval = setInterval(() => {
if (timeLeft
clearInterval(interval);
earnBox.style.display = "inline-block";
// Firebase Earn Save
const user = localStorage.getItem("userEmail") || "guest";
const today = new Date().toISOString().split("T")[0];
const adId = "ad9";
firebase.database().ref("users/" + user + "/ads/" + today + "/" + adId).set({
earned: 0.20,
time: new Date().toLocaleTimeString()
});
} else {
timer.innerText = timeLeft;
timeLeft--;
}
}, 1000);
});
Click Here to Watch Ad & Earn $0.20