Files
kennethreitz 13480d244e Analytics config, keyboard nav, image detail improvements, word cloud sizing
- Analytics code field in SiteConfig (paste any GA/Gauges snippet)
- Image detail: EXIF bar first, download in bar, prev/next nav with
  arrow keys, 'O' for original download, delete button for owner
- Word cloud: log-scaled font sizes, shuffled layout
- Keyboard grid navigation (arrow keys + Enter) on image/gear grids
- Delete redirects to next image instead of dashboard
- Only show AI title, hide Flickr filenames
- Fix remaining hardcoded "ExifTree" in page titles

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 15:58:23 -04:00

36 lines
1.4 KiB
HTML

<script>
(function() {
var cards = Array.from(document.querySelectorAll('.image-grid .image-card'));
if (!cards.length) return;
var idx = -1;
function getCols() {
var cols = 1;
var top = cards[0].getBoundingClientRect().top;
for (var i = 1; i < cards.length; i++) {
if (Math.abs(cards[i].getBoundingClientRect().top - top) < 5) cols++;
else break;
}
return cols;
}
function focus(i) {
if (i < 0 || i >= cards.length) return;
if (idx >= 0) cards[idx].classList.remove('image-card-focused');
idx = i;
cards[idx].classList.add('image-card-focused');
cards[idx].scrollIntoView({ block: 'nearest', behavior: 'smooth' });
}
document.addEventListener('keydown', function(e) {
if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'SELECT') return;
if (e.key === 'ArrowRight') { e.preventDefault(); focus(idx < 0 ? 0 : idx + 1); }
else if (e.key === 'ArrowLeft') { e.preventDefault(); focus(idx < 0 ? 0 : idx - 1); }
else if (e.key === 'ArrowDown') { e.preventDefault(); focus(idx < 0 ? 0 : idx + getCols()); }
else if (e.key === 'ArrowUp') { e.preventDefault(); focus(idx < 0 ? 0 : idx - getCols()); }
else if (e.key === 'Enter' && idx >= 0) { cards[idx].click(); }
else if (e.key === 'Escape' && idx >= 0) { cards[idx].classList.remove('image-card-focused'); idx = -1; }
});
})();
</script>