Created
July 3, 2013 01:01
-
-
Save Gowiem/5914647 to your computer and use it in GitHub Desktop.
Hacker News Voting JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function byId(id) { | |
return document.getElementById(id); | |
} | |
function vote(node) { | |
var v = node.id.split(/_/); // {'up', '123'} | |
var item = v[1]; | |
// hide arrows | |
byId('up_' + item).style.visibility = 'hidden'; | |
byId('down_' + item).style.visibility = 'hidden'; | |
// ping server | |
var ping = new Image(); | |
ping.src = node.href; | |
return false; // cancel browser nav | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment