mirror of
https://github.com/heyarne/airsonic-ui.git
synced 2026-05-06 18:33:38 +02:00
Fix for safari autoplay bug (see #33)
This commit is contained in:
parent
a6b14d6294
commit
d7be60dae4
3 changed files with 10 additions and 5 deletions
|
|
@ -52,7 +52,9 @@
|
||||||
" - "
|
" - "
|
||||||
[:a {:title (:title episode)
|
[:a {:title (:title episode)
|
||||||
:href "#"
|
:href "#"
|
||||||
:on-click (muted-dispatch [:audio-player/play-all episodes idx])}
|
;; the reason for :sync? true can be found here
|
||||||
|
;; https://github.com/heyarne/airsonic-ui/issues/33
|
||||||
|
:on-click (muted-dispatch [:audio-player/play-all episodes idx] :sync? true)}
|
||||||
(:title episode)]]]]
|
(:title episode)]]]]
|
||||||
(episode-actions episode)))])
|
(episode-actions episode)))])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,14 @@
|
||||||
(when (p song) (reduced [idx song]))) nil)))
|
(when (p song) (reduced [idx song]))) nil)))
|
||||||
|
|
||||||
(defn muted-dispatch
|
(defn muted-dispatch
|
||||||
"Dispatches a re-frame event while canceling default DOM behavior"
|
"Dispatches a re-frame event while canceling default DOM behavior; to be
|
||||||
[ev]
|
called for example in `:on-click`."
|
||||||
|
[ev & {:keys [sync?]}]
|
||||||
(fn [e]
|
(fn [e]
|
||||||
(.preventDefault e)
|
(.preventDefault e)
|
||||||
(rf/dispatch ev)))
|
(if sync?
|
||||||
|
(rf/dispatch-sync ev)
|
||||||
|
(rf/dispatch ev))))
|
||||||
|
|
||||||
(defn add-classes
|
(defn add-classes
|
||||||
"Adds one or more classes to a hiccup keyword"
|
"Adds one or more classes to a hiccup keyword"
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
(:artist song))
|
(:artist song))
|
||||||
" - "
|
" - "
|
||||||
[:a
|
[:a
|
||||||
{:href "#" :on-click (muted-dispatch [:audio-player/play-all songs idx])}
|
{:href "#" :on-click (muted-dispatch [:audio-player/play-all songs idx] :sync? true)}
|
||||||
(:title song)]
|
(:title song)]
|
||||||
[:span.duration (format-duration duration)]]))
|
[:span.duration (format-duration duration)]]))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue