Added additional init stuff, fixed event listener refs

This commit is contained in:
2025-08-12 16:10:23 -06:00
parent 149abb716a
commit d76a0fd6eb
2 changed files with 28 additions and 6 deletions

View File

@@ -7,15 +7,21 @@ class pec {
this.image = image; // Add image processing here
this.utterance = new SpeechSynthesisUtterance(this.word);
var root = document.createElement("div");
root.draggable = true;
root.classList.add("pec");
var img = document.createElement("img");
img.src = me.image;
img.classList.add("pecImage");
root.appendChild(img);
var name = document.createElement("span");
name.innerText = word;
name.classList.add("pecNane");
root.appendChild(name);
root.addEventListener("click",()=>{ window.speechSynthisis.speak(me.utterance); });
root.mom = this;
root.addEventListener("click",(e)=>{
var targ = e.currentTarget.mom;
window.speechSynthesis.speak(targ.utterance);
});
this.DOM = root;
}
}