Live data from Hacker News

The Single Piece of JavaScript on HN

blog.watchandcode.com

31–40 of 195 posts

Re: The Single Piece of JavaScript on HN

#35

Earlier quoted context omitted.

Well there appear to be two things stopping this: - Hiding two elements on the page (one can be hidden with the CSS :visited selector) - Remaining with your position on the page whilst also sending a message to the server and without opening new windows. So the only way to do the task is to send a full request to the server which would return you to the page with the buttons correctly disabled. Extra load on the serv…

You could render the vote buttons in iframes, so just the iframe would reload. But you'd have to load N iframes for N vote buttons on page load. Not worth the performance hit.

[deleted]

Re: The Single Piece of JavaScript on HN

#36

Earlier 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.

YES! totally agree

For a subset of us, framework authors, open source contributors, etc. It's very useful to keep up to date on the latest trends.

For example, the Angular team has borrowed techniques from React. It helps for them to keep up with things.

For people like me though, let's be honest. I don't need to do the latest thing.

Re: The Single Piece of JavaScript on HN

#37
post #24

Seeing the "auth" query. There is a chance that HN was "too clever" about it, and it might be possible to use other users id to upvote, or upvote many times, if you can figure out the hash algorithm.

This has already been exploited at least once: https://news.ycombinator.com/item?id=639976

Re: The Single Piece of JavaScript on HN

#38
The HTTP request for voting should be a POST request, not a GET request, since it changes state. So both the JS hack involving an image and the non-JS fallback are broken. The JS function should use XHR, and I guess the non-JS fallback should be a form with an image button, not a link.

Re: The Single Piece of JavaScript on HN

#39

If we ever make it around to a second piece of javascript on here, can I request that it be a collapse comment function? I promise i won't ask for anything else.

This bookmarklet http://pastebin.com/raw/Rur0Lrza works if you have less than 500 karma. I haven't figured out how to make it work for over 500 karma.
Post reply on HN