So without JS enabled you can't vote?
No, you just can't vote without triggering a page navigation. (It's probably HTTP POST with redirect.)
The Single Piece of JavaScript on HN
21–30 of 195 posts
Re: The Single Piece of JavaScript on HN
#22Re: The Single Piece of JavaScript on HN
#23So without JS enabled you can't vote?
Re: The Single Piece of JavaScript on HN
#24Re: The Single Piece of JavaScript on HN
#25function 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…
Re: The Single Piece of JavaScript on HN
#26Re: The Single Piece of JavaScript on HN
#27If 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.
Re: The Single Piece of JavaScript on HN
#28Not much to say, really. Just some simple code. What I'm curious is if someone can reiimplement this without and javascript.
input, input:checked ~ label { display: none; }
---
Up
Down
Re: The Single Piece of JavaScript on HN
#29If 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.
Is there anything like Reddit Enhancement Suite for HN? Any recommendations out there?
https://chrome.google.com/webstore/detail/hacker-news-enhanc...
Re: The Single Piece of JavaScript on HN
#30Not much to say, really. Just some simple code. What I'm curious is if someone can reiimplement this without and javascript.
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…