From f3a24546b0efb5834c70d58bc314afe293f82ab0 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Wed, 6 Nov 2024 16:25:09 -0600 Subject: [PATCH] fix contextmenu --- src/webpage/contextmenu.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/webpage/contextmenu.ts b/src/webpage/contextmenu.ts index 8b37ab2..5cfa017 100644 --- a/src/webpage/contextmenu.ts +++ b/src/webpage/contextmenu.ts @@ -53,11 +53,11 @@ class Contextmenu{ let visibleButtons = 0; for(const thing of this.buttons){ - if(!thing[3].bind(addinfo).call(addinfo, other))continue; + if(!thing[3].call(addinfo, other))continue; visibleButtons++; const intext = document.createElement("button"); - intext.disabled = !thing[4].bind(addinfo).call(addinfo, other); + intext.disabled = !thing[4].call(addinfo, other); intext.classList.add("contextbutton"); if(thing[0] instanceof Function){ intext.textContent = thing[0](); @@ -66,7 +66,10 @@ class Contextmenu{ } console.log(thing); if(thing[5] === "button" || thing[5] === "submenu"){ - intext.onclick = thing[1].bind(addinfo, other); + intext.onclick = (e)=>{ + div.remove(); + thing[1].call(addinfo, other,e) + }; } div.appendChild(intext);