Новых тем за сутки
HTML-низ
Код:
<script>
<!-- Новых тем за сутки (в статистике) -->
(() => {fetch('/api.php?method=topic.getRecent&limit=100&fields=posted')
.then(response => response.json())
.then(dats => {
let numb = 0, day = Math.floor(Date.now()/1000)-86400;
dats.response.forEach(item => {
if (item.posted > day) {
numb++
}
});
let item2 = document.createElement('li'), statscon = document.querySelector('#pun-stats .statscon .item2')
item2.classList.add('item2')
item2.innerHTML = `<span>Новых тем за сутки:</span> <strong>${numb}</strong>`
statscon.parentNode.insertBefore(item2,statscon.nextSibling)
})})()
</script>