TuxedoTako / 4chan-xt

Adds various features to anonymous imageboards.
Other
99 stars 7 forks source link

Firemonkey compatibility? #6

Open Impeta opened 1 year ago

Impeta commented 1 year ago

Testing out your 4chan-XT userscript on Violentmonkey works like a charm, yet on Firemonkey, it won't even start. Nothing happens, the console doesn't report anything at all.

Some small research leads me to these probably interesting insightful topics to look on; https://github.com/erosman/support/issues/507 https://github.com/ccd0/4chan-x/issues/3300

TuxedoTako commented 1 year ago

Clicking the run button manually runs the script, but I ran into this:

https://github.com/erosman/support/issues/429#issuecomment-1605275319

For Custom Events, if the initiator is inside FM's dedicated isolated context with object type event.detail, and the event handler is hooked in the non-isolated environment, event.detail is not accessible.

Seems that after modifying GM functions, ajax functionality also needs a rewrite, since it uses events like that.

Since 4chan-XT or X never advertised Firemonkey compatibility, this isn't really my priority. PR's are welcome, but it's not really on my own to do list.

Katzenwerfer commented 4 months ago

Testing around some stuff. Seems like removing all @grant entries from the metadata header lets the script run without issues. I'm guessing one of the entries in particular is messing up with how FireMonkey runs the script, but I have yet to try that thoroughly.

Katzenwerfer commented 4 months ago

Think it might be these 3. Everything runs fine except changing certain settings.

// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_deleteValue

There might be some recent info about that here https://github.com/erosman/support/issues/507

TuxedoTako commented 4 months ago

Think it might be these 3. Everything runs fine except changing certain settings.

// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_deleteValue

There might be some recent info about that here erosman/support#507

The settings are indeed a thing that use those, but those are not the only one. It seems I can't just replace those with their GM. variant, since I don't see an equivalent for GM_addValueChangeListener, which is used to propagate changes between tabs. There's also a fall-back on localstorage, but that doesn't sync settings between domains.