Tuesday, February 12, 2013

jQuery magic

There is a certain group on Reddit - I'll give you one guess as to which one - that doesn't want you to vote posts or comments up or down unless you are a registered member of "the community". Since this goes against the whole philosophy of Reddit - and since their security is a joke - I decided to post the following information.

I was originally going to post on Reddit itself in a different group, but I decided that this might be considered a little too provocative. So I will just leave this stuff here for your education - I take no responsibility for whether you decide to act on it or not. You're a big boy or girl, and responsible for your own actions. Consider this a lesson in jQuery, the Javascript-based library which Reddit uses.

Even when you don't see the up and down arrows, they are still there, just hidden. But they can still be "clicked". If you want to vote up every comment on a post, or every post on a subreddit page, you can enter the following in your browser's address bar:


Conversely, if you want to vote everything down:


You can even create a bookmark with one of the above "URLs" so you only have to type it once. If you see big red scary notices after voting, you can ignore them.

How does this work? $('.up') gives you a list of all page elements that are members of the "up" class, i.e. the upvote arrows. And $('.down') is - you guessed it - the downvote arrows. Adding "click()" triggers the click event handler of each element in the list, resulting in the desired votes being cast.

Thus endeth the lesson. Go forth and have fun!

No comments:

Post a Comment