`; element.innerHTML = `${eyeIcon} ${views}`; element.title = `${views} צפיות בדף זה`; } function getTotalPageviews(element, path) { let totalViews = data[path] || 0; const redirects = element.getAttribute('data-redirects'); if (redirects) { const redirectPaths = redirects.split(',').map(r => r.trim()); redirectPaths.forEach(redirectPath => { if (data[redirectPath]) { totalViews += data[redirectPath]; } }); } return totalViews; } const currentPath = window.location.pathname; const currentPageViews = document.querySelector('.pageviews[data-path="' + currentPath + '"]'); if (currentPageViews) { updatePageviews(currentPageViews, getTotalPageviews(currentPageViews, currentPath)); } document.querySelectorAll('.pageviews').forEach(element => { const path = element.getAttribute('data-path'); if (path !== currentPath) { updatePageviews(element, getTotalPageviews(element, path)); } }); }) .catch(error => console.error('Error fetching pageviews:', error)); const filterButtons = document.querySelectorAll('.filter-btn'); const categories = document.querySelectorAll('.category'); filterButtons.forEach(button => { button.addEventListener('click', () => { const category = button.getAttribute('data-category'); filterButtons.forEach(btn => btn.classList.remove('active')); button.classList.add('active'); if (category === 'all') { categories.forEach(cat => cat.style.display = 'block'); } else { categories.forEach(cat => { if (cat.id === category) { cat.style.display = 'block'; } else { cat.style.display = 'none'; } }); } }); }); });