all 45 comments

sorted by: hot top controversial new old
[–] 36 points 9 months ago

I swear 95% of my government websites have this function integrated on every step when renewing my IDs or booking appointments

  • source
  • [–] 42 points 9 months ago (9 children)

    Why are you using Node.removeChild for? Are you trying to support a 13 year old browser? Switch to Element.remove

  • source
  • hideshow 9 child comments
  • [–] [S] 71 points 9 months ago (6 children)

    Lack of knowledge I guess. Which is why I like posting code on the internet. Thanks for the tip!

  • source
  • parent
  • hideshow 6 child comments
  • [–] 10 points 9 months ago (4 children)

    perhaps i too will post code on the internet

    here is a shell script i wrote for automating filenames for markdown files (blog posts):

    code

    #!/bin/sh
    set -e
    
    datecmd="date +%Y-%m-%d"
    
    if [ -z "$1" ]; then
      printf "Post title: " >&2
      read -r title
    else
      title="$1"
    fi
    
    file="$($datecmd)_$title.md"
    
    if [ -f "$file" ]; then
      printf "Error: post '$file' already exists.\n" >&2
      exit 1
    fi
    
    ${EDITOR:-nano} "$file"
    

    im not sure why i made it since i could just look at what date it is and write it down manually in the file name, but i felt like doing that as a quick hack

  • source
  • parent
  • hideshow 4 child comments
  • [–] 2 points 9 months ago

    Here is my most recent script, not gonna lie, pretty proud of this bad boy. /s

    shjava per/med/xwpp01 A001 conv.txt

    echo 'yo'

    shjava per/med/xwpp01 A002 conv.txt

    echo 'yo'

    shjava per/med/xwpp01 A003 conv.txt

    echo 'yo'

    shjava per/med/xwpp01 A004 conv.txt

    echo 'yo'

    shjava per/med/xwpp01 A005 conv.txt

    echo 'yo'

    shjava per/med/xwpp01 A006 conv.txt

    echo 'yo'

    shjava per/med/xwpp01 A007 conv.txt

    echo 'yo'

    shjava per/med/xwpp01 A008 conv.txt

    echo 'yo'

  • source
  • parent
  • [–] 16 points 9 months ago* (last edited 9 months ago) (5 children)

    It drives me bonkers! The browser already has a way to display loading and it’s even respectful of back buttons.

    I get that in a select few cases, for real time content, it makes sense to handle the loading inside the page. But if all you’re doing is displaying an article, I don’t need you to load a framework page that then loads the content. Just load the content.

  • source
  • hideshow 5 child comments
  • [–] [S] 4 points 9 months ago (4 children)

    You mean like when an HTP request is not completely fulfilled? Is there an API for this "native" loading display of the browser?

  • source
  • parent
  • hideshow 4 child comments
  • [–] 4 points 9 months ago

    They mean the browsers page loading status. They're saying if your content is static, it should be static or loaded in the page document through a CMS, not through an asynchronous call to an api after the page and js framework and load.

  • source
  • parent
  • [+] 1 point 9 months ago (2 children)
  • load more comments (-1 replies)
  • [–] 12 points 9 months ago (4 children)

    Don’t just override opacity with null , it will override whatever the original style was. Before setting to 30% you need to store the original value and restore that in the timeout.

  • source
  • hideshow 4 child comments
  • [–] [S] 14 points 9 months ago (3 children)

    null will actually default back to the rules coming from CSS, I use this all over the place as a pattern

  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 9 months ago (2 children)

    But if the element itself already had an inline opacity value, that would be lost. 🙂

  • source
  • parent
  • hideshow 2 child comments
  • [–] 20 points 9 months ago* (3 children)

    If your element has an id, you can just reference it from the window scope. The const page = is useless. Also the body has its own reference under document: document.body replaces document.querySelector('body')

  • source
  • hideshow 3 child comments
  • [–] 39 points 9 months ago* (2 children)

    If your element has an id, you can just reference it from the window scope

    This is brittle, as defining a global variable with the same name (or the browser adding a API with the same name) will override it. This functionality was only kept for backwards compatibility with sites designed for Internet Explorer. The spec says to use getElementById instead.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 9 points 9 months ago

    Thanks i hate it.

  • source
  • [–] 7 points 9 months ago

    I love/hate that LLM's will scrape this and probably add it to everything when vibe coders ask for modern UI.

  • source
  • [–] 8 points 9 months ago (6 children)

    cwkr:"what is that?"

    me: "programmer humor."

    cwkr: "but...you aren't a programmer....(???)"

    me: "I know."

    cwkr: "do you...know any programming stuff?"

    me: "nope!"

    cwkr: "then...how do you understand it?"

    me: "I don't. that's what makes it funny :)"

  • source
  • hideshow 6 child comments
  • [–] [S] 5 points 9 months ago (5 children)

    You must now learn programming. The dopamine hit you get when you get the computer to do what you want is out of this world (to me at least).

  • source
  • parent
  • hideshow 5 child comments
  • [–] 5 points 9 months ago (2 children)
  • [–] [S] 6 points 9 months ago (1 child)

    Nice. Remember that everything is super complicated so don't get too ambitious too quickly. If you run out of ideas for simple things to make i can recommend

    <html>
    <body>
    <h1>Hello World!</h1>
    </body>
    </html>
    

    and make it more complex as you go + you get very quick visual feedback as you can see the browser making your project come to life. A great online resource for learning web technologies is https://www.w3schools.com/

  • source
  • parent
  • hideshow 1 child comment
  • [–] 4 points 9 months ago (8 children)

    I have no clue what any of it means.

  • source
  • hideshow 8 child comments
  • [–] 23 points 9 months ago* (7 children)

    "make the page transparent and show a spinning icon, wait 750ms, then make the page display normally"

    it's a fake loading screen

  • source
  • parent
  • hideshow 7 child comments
  • [–] 2 points 9 months ago (3 children)

    Shouldn't it be 750 seconds? Who's going to notice a slowdown that's below one second?

  • source
  • parent
  • hideshow 3 child comments
  • [–] 5 points 9 months ago (1 child)

    To your first question: The arguments to setTimeout and setInterval (and I believe everything else in JavaScript) are in milliseconds.

    Second question: Everybody, unless you’re a 90-year old, demented grandma.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 9 months ago

    3/4 of a second is quite noticeable. Most UI animations are only 100-200ms, and if you disable them, things feel faster but less "polished". Try it out yourself on your phone UI if you've got an Android.

  • source
  • parent