This now sort-of works -- except that play-segment isn't implemented.

This commit is contained in:
Simon Brooke 2025-08-26 12:01:21 +01:00
parent 51d4e88c25
commit a0983e513b

View file

@ -1649,25 +1649,25 @@
(set! (.-my_alert js/window) my-alert)
(defn play-segment [start end] (js/alert "foo"))
;; (js/alert (str "Now we should be playing the sefment from "
;; start
;; " to "
;; end
;; ", but this is not yet implemented.")))
(defn play-segment [start end]
(js/alert (str "Now we should be playing the sefment from "
start
" to "
end
", but this is not yet implemented.")))
;; export function to use from JavaScript:
(set! (.-play_segment js/window) play-segment)
(defn markup-word [record phrase-no word-no]
[:span {:class "word"
:id (str "word-" phrase-no "-" word-no)
:on-click (str "play_segment( " (:start record) ", " (:end record) ")")}
:on-click #(play-segment (:start record) (:end record))}
(str " " (:text record))])
(defn markup-phrase [record n]
[:div {:class "phrase" :id (str "phrase-" n)}
[:button {:class "play-control"
:onclick (str "play_segment( " (:lineStart record) ", " (:lineEnd record) ")")} ">"]
:on-click #(play-segment (:lineStart record) (:lineEnd record))} ">"]
(map #(markup-word %1 n %2) (:words record) (range))])
(let [content (map markup-phrase data (range))]
@ -1678,7 +1678,7 @@
<body>
<audio controls src="resources/audio/japji_bindranwale.mp3"></audio>
<h1><span class="en-GB">Japji</span></h1>
<div id="content">Please wait...</div>
<div id="content" lang="pa">ਕ੍ਰਿਪਾ ਕਰਕੇ ਉਡੀਕ ਕਰੋ...</div>
</body>
</html>