From 7ffcd6b3a81daa2c5a2500ac93f8adcbb2e22f19 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sat, 19 Oct 2024 15:44:50 -0700 Subject: [PATCH] Photo Views: Count a mouseover as a view too For video elements (animated GIFs), since the 'click' for lightbox modal doesn't work, mouseover and play/pause count as views. This can unfairly lead videos to climb as the most viewed images while pictures need a click or a 'like' to count. So, count images as viewed on their mouseover event as well. --- web/templates/photo/gallery.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/templates/photo/gallery.html b/web/templates/photo/gallery.html index c4a971c..093333f 100644 --- a/web/templates/photo/gallery.html +++ b/web/templates/photo/gallery.html @@ -945,7 +945,13 @@ // Log a view of this photo. markImageViewed(photoID); - }) + }); + + // Images: count a mouseover as a view to be on par with videos, otherwise + // videos climb to the top of the most viewed list too quickly. + node.addEventListener("mouseover", (e) => { + markImageViewed(photoID); + }); }); });