diff --git a/assets/js/app.js b/assets/js/app.js index 2185384..88df096 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -5,6 +5,10 @@ import topbar from "../vendor/topbar" let nowSeconds = () => Math.round(Date.now() / 1000) +let execJS = (selector, attr) => { + document.querySelectorAll(selector).forEach(el => liveSocket.execJS(el, el.getAttribute(attr))) +} + let Hooks = {} Hooks.Progress = { @@ -60,10 +64,7 @@ Hooks.AudioPlayer = { this.player.play().then(() => { if(sync){ this.player.currentTime = nowSeconds() - this.playbackBeganAt } this.progressTimer = setInterval(() => this.updateProgress(), 100) - this.pushEvent("audio-accepted", {}) - }, error => { - this.pushEvent("audio-rejected", {}) - }) + }, error => execJS("#enable-audio", "data-js-show")) }, pause(){ diff --git a/lib/live_beats_web/live/live_helpers.ex b/lib/live_beats_web/live/live_helpers.ex index 375fcdf..115a2a8 100644 --- a/lib/live_beats_web/live/live_helpers.ex +++ b/lib/live_beats_web/live/live_helpers.ex @@ -151,9 +151,10 @@ defmodule LiveBeatsWeb.LiveHelpers do |> assign_new(:title, fn -> [] end) |> assign_new(:confirm, fn -> [] end) |> assign_new(:cancel, fn -> [] end) + |> assign_rest(~w(id show patch_to redirect_to on_cancel on_confirm title confirm cancel)a) ~H""" -