1. 14
  1.  

  2. 3

    This is a tool I use pretty regularly.

    On most sites I use, I automate something. Since I don’t like to keep two versions of the code (plain and in bookmarklet form), I wrote this editor to convert the code in both directions.

    You can click on the question mark to get more infos about bookmarklets in general, this editor in particular, and some examples.

    1. 2

      Are bookmarklets usable again, now? It seemed like all the major browser engines were ok with breaking them in favor of CSP so I had pretty much given up on them.

      1. 1

        I’ve been using one a lot, to toggle between looking at Mastodon posts on their home instances vs. on my home instance.

        1. 1

          Is that a simple URL rewrite?

          1. 1

            I pasted it in this, then took that long single line over to Beautifier, and it’s 75 lines long.

            1. 1

              please post a pastebin link! this sounds like an extremely useful bookmarklet 😊

              1. 1

                It’s from this generator, though I might try @no_gravity ‘s, and I’ve seen but not tried another.

                1. 1

                  This works for me:

                  let your_instance="masto.ai";
                  
                  document.location=(
                      "https://"
                      + your_instance
                      + "/authorize_interaction?uri="
                      + encodeURIComponent(document.location)
                  )
                  

                  Before you turn it into a bookmarklet, set your_instance to the Mastodon instance you use.

                  1. 1

                    This seems slower, but the simplicity is pretty appealing.

          2. 1

            I use bookmarklets on pretty much every site I visit regularly, and I never had a problem with CSP.

            Can you give an example of a bookmarklet and a website that do not work together?

            1. 1

              I would imagine the only time csp being a problem is when you connect to some external resource. if you are just modifying things locally it works fine. I have a few bookmarkletes and they work fine.

              1. 1

                That wasn’t the case for ~5 years that firefox wouldn’t run bookmarklets on CSP sites at all, according to the history here: https://bugzilla.mozilla.org/show_bug.cgi?id=866522

                Sounds like they did finally fix the case that doesn’t need subresources, though still haven’t fixed it for those that do.

        2. 2

          Nice. Simple and to the point. We need to bring back this mindset of small yet very useful tools than can be learned in seconds. Bookmarked! Pun intended. Pun intended.