m5l.eu is a Fediverse instance that uses the ActivityPub protocol. In other words, users at this host can communicate with people that use software like Mastodon, Pleroma, Friendica, etc. all around the world.

This server runs the snac software and there is no automatic sign-up process.

Site description
Yet another single-user instance
Admin account
@marek@m5l.eu

Search results for tag #javascript

AodeRelay boosted

[?]Coa Β» 🌐
@coa100@mastodon.social

Avegardyia a game by myself in the endess-runner genre!

Game Features Random sized obstacles and is very challenging!

A Free to play browser game with option to support it!
coa-100.itch.io/avegardyia

    [?]Terence Eden’s Blog Β» 🌐
    @blog@shkspr.mobi

    A simple "copy this code" button in JavaScript

    shkspr.mobi/blog/2026/08/a-sim

    Next to all the code samples on this blog is a little "copy" button. That makes it easier to grab any of the code I've shared.

    The HTML and JS is delightfully simple:

    Copied HTML to πŸ“‹ HTML<button
        onclick="navigator.clipboard.writeText(
            this.parentNode.getElementsByTagName('code')[0].textContent
        );" 
        title="Copy code"
    >⧉</button>
    

    The navigator.clipboard.writeText needs a user interaction to work - so it is tied to a click on the button.

    It takes some plaintext content. But how to get that content? My code samples look like this:

    Copied HTML to πŸ“‹ HTML<pre itemscope itemtype=https://schema.org/SoftwareSourceCode translate=no>
        <button onclick="navigator.clipboard.writeText( this.parentNode.getElementsByTagName('code')[0].textContent );">⧉</button>
        <span>
            <img alt height=32 src=html.svg width=32>
            <span itemprop=programmingLanguage> HTML</span>
        </span>
        <code itemprop=text>[…]</code>
    </pre>
    

    There are various ways I could get that <code> element:

    • Give it a unique ID (but that might clutter the code, or conflict with something else).
    • Use this.nextSibling.nextSibling (but that might not work if the layout changes).
    • Use this.lastChild.textContent (but, again, depends on the layout staying the same).
    • Select based on itemprop (could make the code a bit longer).
    • Complex filtering on a NodeList (urgh).

    None of those are particularly bad per se, so I've chosen the method which makes most sense to me.

    You can read more about my Classless Design, and how I use metadata to identify programming languages, including whether HTML's code blocks be translated.

    To let people know that it has worked, I've added a little popover.

    Every piece of code has it's own dialog element with a unique id:

    Copied HTML to πŸ“‹ HTML<dialog
        id=pop
        popover=hint>Copied JS to πŸ“‹</dialog>
    

    No JavaScript is required to show the popover when the copy button is pressed:

    Copied HTML to πŸ“‹ HTML<button popovertarget=pop popovertargetaction=show>
    

    Closing the the popover hint doesn't require JS; clicking outside it will dismiss it. But a little scrap of JS on the button's onclick will make it disappear after a few seconds:

    Copied JavaScript to πŸ“‹ JavaScriptsetTimeout(
        function() {
            document.getElementById("pop").hidePopover();
        }, 
    3000);
    

    Positioning the popup so it is in proximity to the button also requires CSS - no JS.

    Copied CSS to πŸ“‹ CSSdialog[popover] {
        inset: unset;
        position: absolute;
        padding: .5em;
    }
    

    If CSS isn't loaded, the default is to place it in the middle of the screen.

    OK, that started out simple but got a bit more complex. Sorry!

    The HTML5 Logo.

    Alt...The HTML5 Logo.

      [?]David Culley Β» 🌐
      @davidculley@hachyderm.io

      RE: hachyderm.io/@davidculley/1171

      It's only become worse:

      > 1,834 changed files with 91,910 additions and 77,026 deletions.

      github.com/oven-sh/bun/compare

      For a patch release from 1.4.0 to 1.4.1.

        AodeRelay boosted

        [?]Coa Β» 🌐
        @coa100@mastodon.social

        i got few quality at my itch.io site ;)
        i say that because i see so much stuff that are just not good enaugh or simple not fun.

        anyway feedback and support always welcome!

          0 ★ 1 ↺

          [?]Marek S. Ł. Β» 🌐
          @marek@m5l.eu

          Who could have guessed that running a package sending data over to a page with to render at runtime using two separate embedded Chrome processes could cause my flight simulator to have performance issues?

          Well, once I became the person to guess that and I'm simply translating some textures with everything is butter smooth again.

            0 ★ 1 ↺

            [?]Marek S. Ł. Β» 🌐
            @marek@m5l.eu

            It's been only four weeks and I really love using mise-en-place by @jdx@fosstodon.org So far I've used it for (chronologically):

            - switching between versions, I liked it more than the dedicated anyzig
            - venv activation – it's silly but feels so good, and collaborates with uv
            - ensuring I have the right language server and formatter for a project, be it , , and trying out various options for Python
            - setting LANG="C.UTF-8" only in the specific project folder because refused to work with Polish...

            The final boss was getting a really comfortable Tree-sitter setup: get the CLI, write grammar in , re-generate and run tests on source change as a mise Task. And then I only cloned the repo on another machine and was ready to go!

            This post was written as a more cultured outlet for my excitement instead of aggresively committing mise.toml into every repository I touch

              3 ★ 1 ↺

              [?]Marek S. Ł. Β» 🌐
              @marek@m5l.eu

              I just completed a application for feature phones that periodically reports the position. I was quite surprised I couldn't find anything ready made for my senior user, but it wasn't too difficult to make either.

              Live location is very sensitive data, but the server with TLS and basic authentication gives me more privacy than the big tech cloud. And it only needed reading a bit of MDN and making a basic image based on