Developers! You probably don't need javascript to achieve 90% of your goals. It will just slow your page load speeds.
The Single Piece of JavaScript on HN
81–90 of 195 posts
Re: The Single Piece of JavaScript on HN
#82Earlier quoted context omitted.
What's most fascinating to me about this isn't the simplicity, it's that this code has lived for so long with almost no changes. It's a great counter-example to all the recent articles about JavaScript fatigue. It's good for us to see real examples of sites that aren't caught up in the framework of the week hype. At the end of the day we're trying to make stuff that works. ES5 vs ES6, React vs Angular vs. Ember vs. A…
For the majority of cases that I've seen, these arguments are simply excuses to avoid doing real work. It's way more fun to decide whether your amazingly awesome Unicorn startup is going to use React or Angular, or Express vs. Rails, or whatever than it is to actually go through the hard work of building a customer base and making money.
Re: The Single Piece of JavaScript on HN
#83Not much to say, really. Just some simple code. What I'm curious is if someone can reiimplement this without and javascript.
Or do you mean is there a way to asynchronously vote and hide the voting arrows without a page reload?
Re: The Single Piece of JavaScript on HN
#84I eventually find this bug on just about every project. One time a user complained that all comments would disappear from her posts. Found that an add-on was prefetching all "delete" links, visible only to her.
Re: The Single Piece of JavaScript on HN
#85A few weeks ago I turned off javascript in my browser out of principle and to see if progressive enhancement was still a thing web developers cared about (hint: it's not). I was pleased that HN worked fine, and the only annoying thing was that voting caused a page reload. It's nice to see this get the attention it deserves! Developers! You probably don't need javascript to achieve 90% of your goals. It will just slow…
Re: The Single Piece of JavaScript on HN
#86Why isn't this wrapped in a react component and written with ES7 lambda functions, transpiled from JSX (using babel of course)? God I hate what has happened to the web these days.
Re: The Single Piece of JavaScript on HN
#87Earlier quoted context omitted.
Now I see you are downvoted. I thought your comment was humourous which is always alright to me. In My Humble Opinion downvotes are given out a little too easily here (OK, I'm ready for more downvotes). I hope when I get the downvote ability I will use it wisely, not that many aren't wise.
Downvotes aren't worth worrying about on Hacker News, nor are upvotes. They do tend to even out in time so that only the really objectionable comments get downvoted a lot (and eventually flagged) but because pg more or less decided that there didn't need to be a standard for either, I treat them as worthless.
Re: The Single Piece of JavaScript on HN
#88Earlier quoted context omitted.
That would make the whole downvote system useless. Just post spam comments everywhere then delete them after a day and you’ll always have a positive karma.
Ok, I"m facing an armageddon of downvotes but why the heck was this downvoted? He made a point, that while arguable, is a valid comment. Maybe the discussion of downvoting is bringing more downvotes. Jeeez. Edit: My upvote brought him back to zero, for now.
Re: The Single Piece of JavaScript on HN
#89Re: The Single Piece of JavaScript on HN
#90function hide(id) { var el = document.getElementById(id); if (el) { el.style.visibility = 'hidden'; } } function vote(node) { var v = node.id.split(/_/); var item = v[1]; hide('up_' + item); hide('down_' + item); var ping = new Image(); ping.src = node.href; return false; }
What's most fascinating to me about this isn't the simplicity, it's that this code has lived for so long with almost no changes. It's a great counter-example to all the recent articles about JavaScript fatigue. It's good for us to see real examples of sites that aren't caught up in the framework of the week hype. At the end of the day we're trying to make stuff that works. ES5 vs ES6, React vs Angular vs. Ember vs. A…