mirror of
https://forge.murkfall.net/bluesaxman/librePECS.git
synced 2026-03-13 02:04:20 -06:00
Added additional init stuff, fixed event listener refs
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user