46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
// dotbrew 2024
|
|
|
|
let ass = 0;
|
|
|
|
function switchit() {
|
|
document.querySelector(".text-wrapper").style = "";
|
|
document.querySelector(".text-wrapper").firstElementChild.remove();
|
|
var c = document.querySelector(".text-wrapper").firstElementChild.cloneNode(true);
|
|
c.innerHTML = "";
|
|
document.querySelector(".text-wrapper").appendChild(c);
|
|
|
|
|
|
};
|
|
|
|
function scroll() {
|
|
document.querySelector(".text-wrapper").style.transition = "top 0.5s ease";
|
|
document.querySelector(".text-wrapper").style.top = "-50px";
|
|
setTimeout(switchit, 510)
|
|
};
|
|
|
|
function chgtext(tex) {
|
|
var c = document.querySelector(".text-wrapper").lastElementChild.innerHTML = tex;
|
|
scroll();
|
|
};
|
|
|
|
|
|
$(document).ready(function () {
|
|
$(".fadein").fadeIn(1250);
|
|
});
|
|
|
|
|
|
$("#signin").on("click", function () {
|
|
$(".signinmenu").slideDown();
|
|
});
|
|
|
|
// Pull analytics from /api/analytics
|
|
setInterval(() => {
|
|
fetch('/api/analytics')
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
estCallsMadeStat = data.total.find(stat => stat.tag === "estCallsMade")?.count;
|
|
currentDailyCallsMadeStat = data.daily.find(stat => stat.tag === "dailyCallsMade" && stat.current === true)?.count;
|
|
chgtext(`Total calls made: ${estCallsMadeStat}<br>Today's calls made: ${currentDailyCallsMadeStat}`);
|
|
})
|
|
.catch(error => console.error('Error fetching analytics:', error));
|
|
}, 2000) |