From 33ebd5eb2a62e2505e86c3af541b80f302e80cae Mon Sep 17 00:00:00 2001 From: arne Date: Fri, 21 Nov 2025 07:44:15 +0100 Subject: [PATCH] Start autoplaying gifs only on hover or tap --- src/computersandblues/lodestone/app.cljs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/computersandblues/lodestone/app.cljs b/src/computersandblues/lodestone/app.cljs index 42b54e8..1671a3c 100644 --- a/src/computersandblues/lodestone/app.cljs +++ b/src/computersandblues/lodestone/app.cljs @@ -358,9 +358,12 @@ "video" [:video {:controls true} [:source {:type (str "video/" ext) :src remote-url}] [:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]] - "gifv" [:video {:loop true :autoplay true :muted true} - [:source {:type (str "video/" ext) :src remote-url}] - [:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]] + "gifv" (let [autoplay (r/atom false) + toggle-autoplay #(swap! autoplay not)] + (fn [] + [:video {:loop true :autoplay @autoplay :muted true :on-pointer-enter toggle-autoplay} + [:source {:type (str "video/" ext) :src remote-url}] + [:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]])) [:div [:strong "Unsupported attachment"] [debug attachment]])))