~technomancy/fennel-lang.org

50eec9e8b21fb211175ab29100d5f58ebfc4f4e9 — Phil Hagelberg 2 months ago a8234d3
Add id attributes to video links.
3 files changed, 11 insertions(+), 10 deletions(-)

M conf/all.fnl
M conf/elements.fnl
M conf/talks.fnl
M conf/all.fnl => conf/all.fnl +2 -2
@@ 10,8 10,8 @@
      (fcollect [year 2023 2019 -1 &into [:div {}]]
        [:div {}
         [:h3 {} [:a {:href (.. "/" year)} (tostring year)]]
         (icollect [_ talk (ipairs (. talks.talks year)) &into [:ul {}]]
           (talks.li talk))])
         (icollect [i talk (ipairs (. talks.talks year)) &into [:ul {}]]
           (talks.li i talk))])
      foot]]
    (html)
    (print))

M conf/elements.fnl => conf/elements.fnl +5 -4
@@ 1,13 1,14 @@
{:watch
 ;; TODO: add poster image
 ;; ffmpeg -i file -vf select='gte\(n\,360\)' -vframes 1 poster.png
 (fn [src]
 (fn [i src]
   (let [onclick (: "document.getElementById('v').setAttribute('src', '%s');"
                    :format src)]
     (values [:button {: onclick} "watch"]
             [:a {:href src} [:img {:src "/download.svg"
                                    :class "download"
                                    :alt "download"}]])))
             [:a {:href src :id (.. "video" i)}
              [:img {:src "/download.svg"
                     :class "download"
                     :alt "download"}]])))

 :style
 [[:link {:rel "stylesheet" :href "https://fennel-lang.org/fennel.css"}]

M conf/talks.fnl => conf/talks.fnl +4 -4
@@ 106,7 106,7 @@
         :video "/v/2023/fennelconf-2023-technomancy.webm"}]
  })

(fn li [{: title : speaker : video : url}]
(fn li [i {: title : speaker : video : url}]
  [:li {}
   (case (. speaker-urls speaker)
     url [:a {:href url} speaker]


@@ 115,11 115,11 @@
   (if url
       [:a {:href url} title]
       title)
   (if video (watch video))])
   (if video (watch i video))])

(fn for* [year]
  (icollect [_ talk (ipairs (. talks year)) &into [:ul {}]]
    (li talk)))
  (icollect [i talk (ipairs (. talks year)) &into [:ul {}]]
    (li i talk)))

(fn first-video [year] (. talks year 1 :video))