For that modern web feeling
For that modern web feeling
const page = is useless. Also The body has its own place under document: document.body replaces document.querySelector(‘body’)
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.
Node.removeChild for? Are you trying to support a 13 year old browser? Switch to Element.remove
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
bash #!/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
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’
“make the page transparent and show a spinning icon, wait x seconds, then make the page display normally”
it’s a fake loading screen
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.
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 the loads the article.
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 :)”
here I go!!!
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
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 www.w3schools.com