#Overlay calling macros stopped on 1.14.2

1 messages ยท Page 1 of 1 (latest)

dusty grail
#

Heya I just updated (from 1.11.3) and none of my overlay clicks work... Did I miss a breaking change?
Example:

function impersonate(buttond){
    let e = window.event;
    e.preventDefault();
    if (e.button == 0){ buttond.parentElement.submit();}
}
</script>
</head><body>
<div class="multiple-selected" id="moveBody">
<template id="blank">
<div class="selected-token" id="test">
    <div class="selected-token__image">
        <form action='macro://imp@lib:BS/none/Impersonated?' method="json">
        <input type="hidden" name="tok" value="[r: vSelected]"></input>
        <button type="button" onclick="impersonate(this);" class= "imgButton"><img src="" style="height: 70px; width: 70px;"></img></button>
        </form>
    </div>
    <div class="selected-token__content">
        <h2><span>Name</span>
        <form action='' style="display: inline;"><button type="submit" class="minusHP">-HP</button><input type="hidden" name="tok" value="[r: vSelected]"></form>
        <form action='' style="display: inline;"><button type="submit" class="plusHP">+HP</button><input type="hidden" name="tok" value="[r: vSelected]"></form>
        </h2>
        <div class="selected-token__content__hp" style="">
            <div class="selected-token__content__hp__bar" style="background-color: hsl(120, 75%, 30%)"></div>
            <div class="selected-token__content__hp__value"></div>
        </div>
    </div>
</div>
</template>```
#

instead of when I make that overlay and click the image it impersonates a token it does absolutly nothing, also doesn't put anything to chat or logs

jade panther
#

(just did a search) There is a bug logged against 1.13 recently about lib: tokens with names 3 or less characters causing an error, can you try renaming to 4 and see if that works, at least it will let us know if its the same bug

dusty grail
#

um lol I can try

#

okay I tried renaming it to BSBSB and it still doesn't react via submit buttons

jade panther
#

doh, so two bugs

#

@fallen raven you are them man of 1,001 overlays have you noticed any problems in 1.14.x?

dusty grail
#

rework of my framework into an addion is going to involve SO many @this's

arctic belfry
#

No useful info to add I'm afraid, but as a user of this fw, good to know it's bugged. ๐Ÿ˜…

fallen raven
wicked garnet
#

Wonder if it has anything to do with this: #testing-requests-feedback message

I haven't had the chance to do additional testing since then. The method of calling the macro is different, but seems like too much of a coincidence for separate issues with calling macros to arise

dusty grail
fallen raven
# dusty grail how are you calling macros from button presses then?

I'm using href example: <a class="menuButton" title="Knock" href="'+linkConfigSet+'knock,'+tokenid+'">
Truth is this all came from Rev, I just hacked it to death.
I'm also using pointermap, this was from Melek that I hacked to death (via his overlay examples)
example snip-it: <div class="placement"> <img src="asset://'+apIMGmenuTrans+'" width="'+(cCtrlZ*4.4)+'" height="'+cCtrlZ+'" style="--pointermap: blockopaque;" draggable=false usemap="#mainSelect"> <a class="fade-out-text">'+returnMsg+'</a> </div> <map name="mainSelect"> <area shape="rect" coords="'+cCtrl1+'" href="'+linkConfig+'" title="Configure" > <area shape="rect" coords="'+cCtrl2+'" href="'+linkToggleO+'" title="oCS Overlay Toggle" > <area shape="rect" coords="'+cCtrl3+'" href="'+linkMin+'" title="Minimize" > </map>

dusty grail
#

ah so fake buttons

fallen raven
#

A button is a button to the end user , potato potahto LOL ๐Ÿ™‚

dusty grail
#

Ya, but that does explain it, since my macro to save the dragged position of an overlay fuction DOES work

#

also unrelated reeee

fallen raven
#

Not being a web / html guy and winging most of this, href is not considered "real".

dusty grail
#
<input type="hidden" name="x" id="positionX"></input>
<input type="hidden" name="y" id="positionY"></input>
</form>``` this gets hit with a javascript submit and works on the overlay
#
        <input type="hidden" name="tok" value="[r: vSelected]"></input>
        <button type="button" onclick="impersonate(this);" class= "imgButton"><img src="" style="height: 70px; width: 70px;"></img></button>
        </form>```
#

that which should call this: function impersonate(buttond){ let e = window.event; e.preventDefault(); if (e.button == 0){ buttond.parentElement.submit();} }

#

does NOT submit

fallen raven
#

Ok, got it.
You did show me something new though (and showing my ignorance) <img src="" didn't know you could do that, I never tried, I ended up using a small transparent image for "blank" spots.

dusty grail
#

well, to be fair I got a script that goes in and fills that in

fallen raven
#

Very clean, I need to improve ๐Ÿ™‚

dusty grail
#

eh a lot of it was steaing existing examples xP

arctic belfry
#

Isn't that all programming (or 99% of it)?

fallen raven
#

ChatGPT is getting closer to some of this . . .

dusty grail
#

I did have chatgpt make my php script that puts up all my log files

#

oh wait

#

just noticed

#

the macrosaren't working are prety short

#

'imp'

fallen raven
#

Oh, good catch, if you push it to 4 does it work and this is a symptom of that other problem?

dusty grail
#

sadly no

#

also wow all my libraries are 2 or 3 letters long

#

I'd have to rewrite SO MUCH CODE if it was that

#

verified it doesn't call it at all, put a broadcast intead of that code...

#

for the impersonate thing

#

is the href just a macro link?

fallen raven
#

But this is a bad-practice as it's a var I'm setting and not using "inside" of javascript.

dusty grail
#

I messed with console log

#

the form action as of the button being pressed is that

#
     //buttond.parentElement.submit();
    let e = window.event;
    e.preventDefault();
    if (e.button == 0){ console.log("I saw that button"); console.log(buttond.parentElement.action);buttond.parentElement.submit();}
}```
#

this is bizzare

#

that doesn't submit

#

changed it to if (e.button == 0){ console.log("I saw that button"); console.log(buttond.parentElement.elements[0].value);buttond.parentElement.submit();}

#

correctly reads the vaule it's supposed to be sending

#

does not submit

#

logged the outer html:

#

calling a submit onthat doesn't seem to work

fallen raven
#

Oh wait a min. I've been away and just realized the 1.14.2 reference. I've not installed that, will do so now (ffs how'd I miss that )

dusty grail
#

more insanity!

#

the javascript thinks it submits

fallen raven
#

Ok, it's all good in 1.14.2 as well.

dusty grail
#

the macro i replaced:

#

trying it not be a button, still no dice

fallen raven
#

but if you did test it using href it would work?

dusty grail
#

that might be hard, let me check

fallen raven
#

Style I'm using and code example <div class="menuContainer"> <div id="topRow" class="topRow"> <button class="topRowButton bgBlack '+page0_Active+'" data-page="0"><img id="doorClosed" alt="Door Menu" title="Doors" src="asset://'+apIMGdoorClosedOG+'"></button> <button class="topRowButton bgBlack '+page1_Active+'" data-page="1"><img id="padStep" alt="Pads" title="Step On" src="asset://'+apIMGpadStep+'"></button> <button class="topRowButton bgBlack '+page2_Active+'" data-page="2"><img id="menuToolbox" alt="Toolbox" title="Toolbox" src="asset://'+apIMGmenuToolbox+'"></button> <button class="topRowButton bgBlack '+page3_Active+'" data-page="3"><img id="itemOther" alt="Other Item" title="Interact" src="asset://'+apIMGitemSelect+'"></button> <button class="topRowButton bgBlack '+page4_Active+'" data-page="4"><img id="itemConfig" alt="Config Item" title="Options" src="asset://'+apIMGitemConfig+'"></button> </div> <div id="page0" class="'+page0_ShowHide+'"> <a class="menuButton" title="New Door&#013; Template"href="'+linkDoorSet+'doorNew,'+apMenuX+','+apMenuY+'"><img id="doorNew" alt="New Door Template" src="asset://'+apIMGdoorSizingV2 +'">'+chk_FRMhtml+'</a> <a class="menuSpacer"></a> <a class="menuButton" title="Set Door Closed" href="'+linkDoorSet+'doorCLD,'+tokenid+'"><img id="doorClosed" alt="Set Door Closed" src="asset://'+apIMGdoorClosed +'">'+chk_CLDhtml+'</a> <a class="menuButton" title="Set Door Cracked" href="'+linkDoorSet+'doorCRK,'+tokenid+'"><img id="doorCracked" alt="Set Door Cracked" src="asset://'+apIMGdoorCracked +'">'+chk_CRKhtml+'</a> <a class="menuButton" title="Set Door Open" href="'+linkDoorSet+'doorOPN,'+tokenid+'"><img id="doorOpen" alt="Set Door Open" src="asset://'+apIMGdoorOpen +'">'+chk_OPNhtml+'</a>

wicked garnet
#

Jmr, does your overlay go through JS? It sounds like Akaiku's does, but not sure about yours.

One of the differences in the issue I was having with macros running from frames was whether it passed through JS or not - though there were other differences and I haven't totally narrowed things down yet.

fallen raven
#

It does not.
I do have this menu bar in JS via pointermap not buttons, and that works (ala fake buttons ๐Ÿ™‚ ).

dusty grail
#
<input type="hidden" name="x" id="positionX"></input>
<input type="hidden" name="y" id="positionY"></input>
</form>``` this submits from javascript just fine in the same overlay
fallen raven
#

longer name? not using onSubmit?

dusty grail
#

onsubmit was me putting it in for testing

#

was not in original

#

also original was imp, renamed it to imperson

fallen raven
dusty grail
#

none of them work

dusty grail
dusty grail
#

I can probably upload the campaign, but it's sorta complicated and large

#

to test that one, go to the Si En Kelar map, impersonate the perra player token, at that point a bunch of buttons should show up in the bottemof the map window. With that token selected and impersonated use the campagin macro overlay which should put a picture etc in the upper left

#

left click on picture should center and impersonate instead of nothing + and - hp should pop up a different thing for hp but doesn't

#

also all the buttons at the bottem should call the corrisponding macro on the impersonated token but don't, you can see them and they work in the normal macro spot

fallen raven
#

It is the same for me on your campaign, so I'd expect it's along the lines of what PMofMalasia said re: a new javascript interoperability issue.

dusty grail
#

ug

#

I don't know how to further troubleshoot it

fallen raven
#

Not suggesting you convert to this other way. I'm attaching the most compressed, code wise, version of the overlay solution I'm using.
I'm sure it's ugly in comparison but works in 1.14.2.

dusty grail
#

I guess I could try to figure out how to convert to fetch()

#

since forms is old way

#

ug fetch is only async

dusty grail
#

1.13.2 works

#

14.0 a2 works

#

a3 good

#

RC1 blows up trying to load the campaign and genererates endless errors on map change

#

RC2 is the current doesn't push buttons so it's something between a3 and rc2

jade panther
#

Do you have a small self contained example I can test with to make it easier to track down

dusty grail
#

not even a little, also latest nightly still doesn't work

#

I can probably try to make a way paired down one though

#

is there a release you want me to make the campaign file in?

#

currently pairing it down in the alpha 3 that worked

jade panther
#

I guess any release you have installed where it works

dusty grail
#

simple how? code to folow or ability to demonstrate issue?

fallen raven
#

I'd expect the most minimalistic least complex way to duplicate problem.

wicked garnet
#

I have a guess as to how I can simplify mine down, will try to have it done later today

dusty grail
#

sonofa, my really really minimum works

fallen raven
#

Well that's still something. Keep adding back bits till it breaks.

dusty grail
#

ug that's horrible to do, it's literally call this that calls that that calls this that generates that from whatever it read from that again

jade panther
dusty grail
#

when I basically took the generated text and told it to spit out the outer html, ripped out the css it added and hard set the generated stuff it ws fine

#

oh ya, my ez short one was 'there is one token, when the map launches there will be a picture in the upper left. if you click on it, it SHOULD impersonate'

#

why and how it got there is a bit complicated

fallen raven
#

What if you take unfettered code, and start removing parts and setting things static to see where it may break.
I couldn't get it to broadcast just clicking the add / minus HP after changing the macros on lib:bs

#

Or keep adding to your "it worked" campaign till it breaks.

dusty grail
#

that has one pc token and the lib responsible for drawing stuff

#

in theory when you open it it'll load the overlay

#

if you click the picture it should impersonate the token

#

the command more or less responsible for opening said overlay is `[overlay("Character Select"): {[r: getLibProperty("characterOverlayHTML", "lib:bs")]
}]

`

fallen raven
#

I get a fail on open for that campaign file.

dusty grail
dusty grail
fallen raven
#

1.14.2

#

I'll try 1.14.0

dusty grail
#

it opened in my 1.14.2

fallen raven
#

actually I didn't keep 1.14.0, I'll have to try 1.14.1

dusty grail
#

how odd

fallen raven
#

file open works (in 1.14.2)
double-click from explorer, fails
but my other campaigns don't fail.
And the large campaign you sent before didn't fail.

Very odd.

dusty grail
#

maybe cause it was made by deleting a ton of stuff in the really big campaign

fallen raven
#

some buttons are working though so is this some sort of "nesting" calling depth thing?

dusty grail
#

which buttons?

#

the ones at the bottem will do their cool little shuffle without asking maptool

bright barn
dusty grail
#

purple buttons call script on the overlay

#

top ones should call up a frame

fallen raven
#

yes, that is working.

dusty grail
#

the purple ones do not rely on calling maptool, the other ones do

jade panther
#

1.14.0, 1.141, 1.14.2 are same, its just the build for some platforms didn't work in 1.14.0 and 1.14.1

fallen raven
#

@dusty grail were is this macro?
[h: bs.tokens()]

dusty grail
#

would be what clicking should be

dusty grail
bright barn
dusty grail
#

basically it's a helper function to have people be able to select which tokens show up on that overlay

#

the current state already has the only actually valid token keeping that

#

sucks i'm going to have to re-think my pref storage since I can't use json.path.put with spaces anymore

#

probably just end up base64 all the things again

jade panther
#

ok @dusty grail downloaded the campaign, what are steps to reproduce bug in that campaign

dusty grail
#

click dragon picture in top left

#

it should impersonate it

#

bug it doesn't

#

also the + and - hp ones should complain about not being a real macro instead of doing nothing

fallen raven
#

when I look at the HTML code coming from the lib:bs property
I see things like this:
<form action=''
(not saying that is right or wrong but just stuck out to me).

#

Is that correct?

dusty grail
#

ya

#

it's a template

#

javascript up top fills it in with data

#
{
    let mainBody = document.getElementById("moveBody");
    mainBody.style.top = yOffset;
    mainBody.style.left = xOffset;
    for(let x of arrayToCreate)
    {
        let newNodeDoc =  document.getElementById("blank").content.cloneNode(true);
        let newNodeDiv = newNodeDoc.firstElementChild;
        newNodeDiv.id = x["id"];
        
        //clicky image stuff
        let newNodeImgForm = newNodeDiv.children[0].firstElementChild;
        newNodeImgForm.children[0].value = x["id"]; //
        newNodeImgForm.children[1].children[0].src = x["pic"];
        
        //headerbar
        let newNodeHeaderBar = newNodeDiv.children[1].children[0];
        newNodeHeaderBar.children[0].innerText = x["name"];
        newNodeHeaderBar.children[1].action = "macro://loseHP@lib:BS/all/" + x["id"] + "?";
        newNodeHeaderBar.children[1].children[1].value = x["id"];
        newNodeHeaderBar.children[2].action = "macro://gainHP@lib:BS/all/" + x["id"] + "?";
        newNodeHeaderBar.children[2].children[1].value = x["id"];
        
        //append here so other stuff works
        document.getElementById("moveBody").appendChild(newNodeDoc);
        //hpbar
        updateHP(x["id"], x["hpCurrent"], x["hpMax"]);
        //drag powers
        dragElement(document.getElementById(x["id"]));
    }
}```
fallen raven
#

I bet that's the only part not working (regarding this issue).

#

I'm out of time atm but I'd be curious if you "forced" the populate of those form actions, instead of dyanimc, if it would work (to help narrow it down).

dusty grail
#
        <form action='macro://imp@lib:BS/none/Impersonated?' method="json">
        <input type="hidden" name="tok" value="[r: vSelected]"></input>
        <button type="button" onclick="impersonate(this);" class= "imgButton"><img src="" style="height: 70px; width: 70px;"></img></button>
        </form>
    </div>```
jade panther
#

@cerulean sigil how is your memory on this change? good enough that it might be an easy fix?

$ git bisect bad
d28175bb5ffa88fc5d237e72e81a7bc70a0dcae7 is the first bad commit
commit d28175bb5ffa88fc5d237e72e81a7bc70a0dcae7
Date:   Tue Sep 12 14:13:54 2023 -0700

    Remove child node enumeration when registering HTML5 event listeners

    Our JS `MutationObserver` observes all added nodes, so `HTMLWebViewManager::handleAddedNode()` will be called for every
    node in the document. Thus we don't need to "discover" child nodes ourselves as they will be directly handled by
    `handleAddedNode`.

 .../client/ui/htmlframe/HTMLWebViewManager.java    | 37 ----------------------
 1 file changed, 37 deletions(-)
cerulean sigil
#

Memory isn't too bad.

jade panther
cerulean sigil
#

Haven't been following this thread though, what's going on? Is it just form actions breaking?

jade panther
#

@dusty grail / @wicked garnet is it all form actions or just ones updated via JavaScript?

dusty grail
#
        <form action='macro://imp@lib:BS/none/Impersonated?' method="json">
        <input type="hidden" name="tok" value="[r: vSelected]"></input>
        <button type="button" onclick="impersonate(this);" class= "imgButton"><img src="" style="height: 70px; width: 70px;"></img></button>
        </form>
    </div>```
#

this one's form remains untouched for edits

#

and doesn't work

wicked garnet
#

Haven't quite pinned down what conditions make them fail yet.

dusty grail
#

ironically the move submittal DOES call, and that's fired by javascript

#

right click on the picture of dragongirl and drag should move then complain about get.put

cerulean sigil
#

Sorry if this has already been hashed out, but the key seems to be that the form was created as part of a deep clone. Minimal example:

<html>
    <head>
        <script>
            window.addEventListener('load', e => {
                let node =  document.getElementById("blank").content.cloneNode(true);
                document.body.appendChild(node);
            });
        </script>
    </head>
    <body>
    <template id="blank">
        <div>
            <form action="macro://submit@lib:Example/none/Impersonated?" method="json">
                <button type="submit">Submit Me</button>
            </form>
        </div>
    </template>
    </body>
</html>

Just removing the wrapper <div > is enough to make it work. And it doesn't matter whether cloned out of a template or from somewhere else, it's broken either way.

dusty grail
#

lol ya, can confirm my button bar buttons that actually aren't created via that work

#

note it's not even a deep clone per sey

#

okay I can't paste it in

#

but like a bit of code that makes nodes, then appends them, then appends THOSE nodes to existing stuff doesn't work either

#

^that

cerulean sigil
#

Yeah, I was pretty mistaken about how MutationObserver works when deep trees are added. I thought had tested this sort of case but apparently not ๐Ÿ˜”
I think I can fix this, will do some testing on it later. Gonna have to get a bit creative though.

jade panther
dusty grail
#

seems to fix ya

bright barn
bright barn
#

Yup, fixed. thanks, @cerulean sigil and @jade panther

jade panther
#

It was mostly @cerulean sigil he had the hard part, I just pushed some buttons and did a copy and paste

wicked garnet
# jade panther <@413892476227551232> , <@273284159076696065> , <@678384715769708566> I have cre...

It's fixed for me! Thanks to both of you. Just a heads up, this issue was associated with it: https://github.com/RPTools/maptool/issues/4435

GitHub

Describe the Bug When a macro link is used via macroLinkText() in a frame and then clicked, it fails to actually execute the linked macro. Outputting the exact same link to chat executes the linked...

dusty grail
jade panther