summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorctucx <c@ctu.cx>2021-03-07 01:24:44 +0100
committerctucx <c@ctu.cx>2021-03-07 01:24:44 +0100
commitdec620c7bc842add097201f0c904a39cc5956c9c (patch)
tree607a786a043f6066a391eb828b204b3ee838f178
parent0a9512e9f7df1a60b376fc8620ce1d2ba444ef58 (diff)
webmusic.js: set onclick-event on state element just once
-rw-r--r--webmusic.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/webmusic.js b/webmusic.js
index e4f2c6c..6f9e166 100644
--- a/webmusic.js
+++ b/webmusic.js
@@ -71,8 +71,9 @@ window.onkeyup = function (event) {
function initState() {
const dirElements = document.querySelectorAll(".dir");
const fileElements = document.querySelectorAll(".file");
+ let id = 0;
- let id = 0;
+ document.getElementById("state").addEventListener("click", togglePlayback)
dirElements.forEach(function(element){
element.id = id++;
@@ -166,7 +167,6 @@ function toggleContinue() {
}
function updateState() {
- document.getElementById("state").setAttribute('onclick', 'togglePlayback()');
let statestr = "[";
statestr += gstate;
if (sound.playing()) {