Move HTMX code to module
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Isaac Mills 2025-07-10 12:54:34 -06:00
parent 5666f243bb
commit 4e7f4070ba
Signed by: fnmain
GPG key ID: B67D7410F33A0F61

View file

@ -1,7 +1,8 @@
import htmx from 'htmx.org'; import 'htmx.org';
import '/src/htmx_import.js' import '/src/htmx_import.js'
import AudioMotionAnalyzer from 'audiomotion-analyzer'; import AudioMotionAnalyzer from 'audiomotion-analyzer';
htmx.onLoad(function(target) {
addEventListener("load", (_event) => {
const container = document.getElementById('audioContainer'); const container = document.getElementById('audioContainer');
const audioSource = document.getElementById('player'); const audioSource = document.getElementById('player');
const audioMotion = new AudioMotionAnalyzer(container, { source: audioSource }); const audioMotion = new AudioMotionAnalyzer(container, { source: audioSource });
@ -17,6 +18,6 @@ htmx.onLoad(function(target) {
function drawCallback(instance, _info) { function drawCallback(instance, _info) {
const energy = instance.getEnergy() * 150; const energy = instance.getEnergy() * 150;
target.style.setProperty('--energy', energy + 'px'); document.documentElement.style.setProperty('--energy', energy + 'px');
} }
}); });