document.addEventListener('DOMContentLoaded', function() { const fileId = document.getElementById('fileTracker').getAttribute('data-file-id'); fetch(`https://stats.bunkr.ru/api/file/stats/${fileId}`) .then(response => response.json()) .then(data => { if(data.downloadCount !== undefined) { // Update the download count display const countDisplay = document.getElementById('downloadCount'); countDisplay.textContent = `${data.downloadCount} views`; // Unhide the download count display (assuming you want to show this separately) countDisplay.style.display = 'block'; // Optionally, if you want to unhide the fileTracker div instead (or as well) // document.getElementById('fileTracker').style.display = 'block'; } }) .catch(error => console.error('Error fetching download count:', error)); });