I’m not too studied-up on CORS, but I know what it’s there for. Currently there’s a number of things that are not possible to do because our generator is on a different subdomain than other generators or iframes, etc. etc. and even the top-level page we’re actually on.

With that allowed (I think CORS can allow this), there’s a lot more customisation we can do of things like t2i image iframes and gallery iframes, reading/changing the top-level url, etc. Maybe that’s something you don’t want to allow, but I for one have wanted to do these things for completely benign legit reasons multiple times.

  • wthit56@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 months ago
    1. 👍 :target works too!
    2. 👍 And it updates from using it in the editor without actually booting you out of the editor, which is a nice touch as well!
    3. 👍
    4. 👍 And you can call just “?params” too in the regular method, which works in perchance as well. Maybe you could only allow that. Make sure it only starts with “?” or something. A note about the error it gives you when it’s a disallowed path… not being able to see the path it’s received is a bit annoying. When I throw, I like to give as much info as I can about the thing I’m throwing about, so they don’t have go and start logging things out or breakpointing just to understand the reason it threw. (Wait–generatorName is a thing?! I’ll make use of that for one of my private plugins 👍 Should I scour the windows object for such hidden gems??)
    5. 👍 I can also replaceState with “#hash”. 👍 And doesn’t scroll, though the normal method doesn’t scroll so that’s okay.
      • The :target doesn’t change though, when it does for the normal method.
      • And if you do this from the editor preview, it does add all the params from the preview iframe. Which… is probably okay, fine by me. Presumably those won’t show up unless you’re in the editor anyway.
      • Worth people noting, clicking a link to #edit does not go to edit mode, neither does setting .hash, or doing it with replaceState. Also fine.
    6. 👍
    7. Gallery buttons setting 👍 I’M SO HAPPY! :D

    Test page I used for trying all these out: https://perchance.org/testing-features-19-aug-24-498573958#edit

    • perchance@lemmy.worldM
      link
      fedilink
      English
      arrow-up
      1
      ·
      3 months ago

      :target

      What’s this?

      not being able to see the path it’s received is a bit annoying

      Fixed, thanks!

      Should I scour the windows object for such hidden gems

      Nope, just https://perchance.org/advanced-tutorial - and if you find something that you want to use, but isn’t documented there, please let me know

      • wthit56@lemmy.worldOP
        link
        fedilink
        English
        arrow-up
        1
        ·
        3 months ago

        :target is a css pseudo-selector. So you could put a:target { color:red; }, and then links will be red if they have the id of the #hash. Lets you visually change elements when they’re the one being linked to.

        Ah, admittedly I did sorta skim that doc; I’d read so much stuff that day from everywhere else 😅