Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

papers index: sort by hit count + show view counts per paper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+39
+39
system/public/papers.aesthetic.computer/index.html
··· 181 181 .p .detail a { color: var(--purple); } 182 182 .p .detail a:hover { text-decoration: underline; } 183 183 .p .meta-row { display: flex; gap: 1em; font-size: 0.85em; margin-bottom: 0.1em; align-items: center; } 184 + .p .meta-row .hits { color: var(--cyan); } 184 185 .p .updated { color: var(--cyan); opacity: 0.85; } 185 186 .p .created { color: var(--dim); opacity: 0.7; } 186 187 .p .created::before { content: "est "; } ··· 852 853 a.addEventListener('click', () => trackHit(id, fmt)); 853 854 }); 854 855 }); 856 + 857 + // Sort papers by hit count (most read first) and show counts 858 + (async () => { 859 + try { 860 + const res = await fetch('https://aesthetic.computer/api/paper-hit'); 861 + if (!res.ok) return; 862 + const { stats } = await res.json(); 863 + // Aggregate hits per paper (combine pdf + cards formats) 864 + const totals = {}; 865 + for (const s of stats) { 866 + const id = s._id.paper; 867 + totals[id] = (totals[id] || 0) + s.count; 868 + } 869 + const container = document.querySelector('.p')?.parentElement; 870 + if (!container) return; 871 + const papers = [...container.querySelectorAll('.p')]; 872 + // Inject hit counts into meta rows 873 + for (const p of papers) { 874 + const id = p.dataset.paperId; 875 + const count = totals[id] || 0; 876 + const metaRow = p.querySelector('.meta-row'); 877 + if (metaRow && count > 0) { 878 + const span = document.createElement('span'); 879 + span.className = 'hits'; 880 + span.title = 'Views'; 881 + span.textContent = count + ' view' + (count !== 1 ? 's' : ''); 882 + metaRow.prepend(span); 883 + } 884 + } 885 + // Sort descending by hits 886 + papers.sort((a, b) => { 887 + const ha = totals[a.dataset.paperId] || 0; 888 + const hb = totals[b.dataset.paperId] || 0; 889 + return hb - ha; 890 + }); 891 + for (const p of papers) container.appendChild(p); 892 + } catch {} 893 + })(); 855 894 856 895 // Theme toggle 857 896 function toggleTheme() {