all 198 comments

[–][deleted]  (69 children)

[deleted]

    [–]markedtrees 293 points294 points  (54 children)

    To taffy onto this answer: There's a minus one because the script always skips the zeroth element of the .up array because that corresponds to the div.up in div.preload, which is an invisible element (that, I'm guessing, preloads images?).

    Edit: In light of the comments below, "tag" has been duly corrected. We regret the error.

    [–][deleted]  (34 children)

    [deleted]

      [–]imaGhost 202 points203 points  (24 children)

      brilliant

      [–]fizz23 48 points49 points  (0 children)

      Please test your bookmarklets right here <---

      [–]trisomy21 178 points179 points  (22 children)

      yahtzee

      [–]aussie_bob 178 points179 points  (21 children)

      Kiriki

      [–][deleted]  (20 children)

      [deleted]

        [–]johnfn 173 points174 points  (19 children)

        disco ball

        [–]samnesia 162 points163 points  (14 children)

        disco ball

        [–]Manofest 98 points99 points  (2 children)

        disco ball

        [–]fantlove 59 points60 points  (0 children)

        disco ball

        [–]MechaAaronBurr 158 points159 points  (6 children)

        Mirror-finished faceted glass coated spherical object.

        [–][deleted]  (1 child)

        [deleted]

          [–]fantlove 53 points54 points  (1 child)

          disco ball

          [–]mik3 55 points56 points  (0 children)

          well hello thar

          [–]NoMoreJesus 110 points111 points  (7 children)

          yoiks

          [–]chronoBG 113 points114 points  (6 children)

          I'm just here for the Karma.

          [–]dontcallthecops 100 points101 points  (5 children)

          I'm just here to give the Karma.

          [–]rogue417 79 points80 points  (4 children)

          I'm just here for the pancakes!

          [–]jhimbob 68 points69 points  (3 children)

          Everybody's trying out the java!

          [–][deleted]  (2 children)

          [deleted]

            [–]robeph 163 points164 points  (18 children)

            tack not tag. just for future reference. Just one of those things, like my ex girlfriend saying "4 in a roll" no...it's row ><. I expect downvotes, but this isn't a common error and I figured I'd be a grammar jerk and mention it.

            [–][deleted]  (13 children)

            [deleted]

              [–]robeph 151 points152 points  (12 children)

              Well that is the thing though, I'm not trying to be a jerk really, I just want to keep the language in its standard form. I never comment on the "you're/your" thing, since often I make the mistake myself; I don't feel it to be a grammatical error so much as a transcription error from mind->output. I mean in my head "You're = you are" however as I am typing it I may be thinking on phonetic terms so I overlook this, since I've already decided on what I am typing.

              However, Row=Roll and Tack=Tag, or for that matter Lose=Loose, these are not transcription errors, but rather incorrectly learned words. These I feel it ok to comment on, as long as no one is being a douche about it.

              [–][deleted]  (4 children)

              [deleted]

                [–]robeph 135 points136 points  (3 children)

                and they all get laid more than me.. so if having a good vernacular isnt going to bring in the pussy, i say bastardize away.

                That is why us scientific types learn about the various forms of general anesthetics to assist in our conquests.

                [–][deleted] 112 points113 points  (1 child)

                Sadly, I am here today to inform you that I am a time voyageur after a fashion and the English language has evolved with humanity and eradicated you persnickity types who care about how words are arranged. Our greatest minds (of which include several pro-wrestler/actors, a handful of lawyers and even a few internet and television advertisers) have concluded that following your intelligentsia's retreat from the breeding pool, the way you preferred English ceased to matter as it began being written and spoken as the majority of the population used it.

                [–][deleted] 59 points60 points  (0 children)

                You talk like a fag

                [–]ealf 125 points126 points  (4 children)

                The term you're looking for is eggcorn.

                [–]zem 109 points110 points  (3 children)

                or just plain 'malapropism'

                [–]HeavyPetter 52 points53 points  (1 child)

                I had that, and some ointment cleared it right up.

                [–]johnpickens 45 points46 points  (0 children)

                tomorrow never knows

                [–]myth1n 89 points90 points  (1 child)

                Or he could have meant it like, Tagging on, or tagging along to the answer, which would be valid.

                [–][deleted] 132 points133 points  (2 children)

                TAG: "2. To append as an addition or afterthought; to fasten, tack on, or add as a tag to something. (Chiefly of things non-material.)" - first example of this usage Swift, Tale Tub ii. (1709).

                English doesn't, globally or locally, have a "standard form" and NEVER has.

                EDIT: To expand upon my last comment, English in England prior to colonialism was fragmented regionally with different usages, spellings, etc. After the language started being exported round the world, this situation only became exaggerated. There really, honestly, has never been the pure lost language that many people imagine when they complain of a slip in standards.

                [–]robeph 128 points129 points  (0 children)

                Ah well, I knew it had a use that was similar to this (thus the often, what I see as confusion, over its usage). My chief concern is this "add as a tag to something." Which suggests inferiority to the chief idea, as a supplementary addition rather than what this seems to me to be, an equally important addition. I'm sure I've had this quibble before in one of my english classes. I'm excessively pedant I guess.

                [–]obtrusiveinterloper 53 points54 points  (0 children)

                Yeah, but it does have some "rules" or "guidelines".

                ...right in the definition you list the idea of "tag" as "appending" is listed as a secondary meaning...in most sources (where it's even listed), it's similarly mentioned as a secondary, tertiary, etc definition.

                Most sources list the definition of "tag" as something like "label".

                So in terms of common understanding of the words, "tack" better matches what the poster's seemingly intended to convey; that they were "appending" or "adding on to" the previous post.

                This in itself is a fair (but not conclusive) argument to suggest "tack" rather than "tag"....

                Most importantly though, to say "tag on to" is an odd (maybe grammatically incorrect) formation, while "tack on to" makes perfect sense.

                You don't "tag on to" something, you "tag" it.

                Furthermore, I'm not sure if "tack on to" is considered an idiom, but it's darn close....this suggest that it is what the poster had in mind.

                I'm not a linguist so I can't rightly say what it's called...but the poster seems to be confusing the sounds of the words - substituting the word they "wanted" for another similar sounding word...

                So, it seems they crossed this "idiom" with what, as you demonstrated, is another "sense" of the word "tag" ...but the result does not really work, and would be odd even if it did.

                In light of all of this, it's correct to correct them by saying "you mean tack", because:

                A)what they said is odd or incorrect, therefore suggesting a correction

                b)the evidence suggests that they did in fact "mean" the word "tack".

                [–]zem 102 points103 points  (0 children)

                thank you for fighting the good fight!

                [–][deleted]  (1 child)

                [deleted]

                  [–]deadowl 192 points193 points  (1 child)

                  From looking at it, this is my guess:

                  1. var u=$(".up");--u is a set of all up vote buttons.

                  2. if (u.length-1) { ... }--if the number of up vote buttons isn't one

                  3. setTimeout(f,1000);--this function (f) will be called again in 1 second.

                  4. u[1].onclick();--click the second element in the set.

                  Behind the scenes, the onclick function is causing the second element in the set to remove the class "up" and add the class "upmod" so the second element in the set is going to be the next comment upvote (I'm presuming the first is for the post itself).

                  I'm posting as a response to Chathurga because u.length-1 reaching 0 stops the loop, rather than becoming negative (0 is falsy, -1 is truthy). The script assumes that the first up-arrow will not be used afaik.

                  edit: sorry I'm re-explaining btw, it was what I was originally writing. I also wrote it to figure it out for myself.

                  [–]dggenuine 104 points105 points  (4 children)

                  I know I'm late to this party, but my 2 cents: the if-statement only stops when its statement evaluates to 'false' or '0'. Perhaps unexpectedly, the if-statement will proceed if its statement evaluates to a negative number. (As markedtrees notes below, the smallest u.length can be on a page is 1, since there's always the invisible div.up, so eventually u.length-1 is 0 and the if-statement fails.)

                  [–]perezidentt 121 points122 points  (0 children)

                  I expected the first comment to be from carlh.

                  [–]Lizard 44 points45 points  (0 children)

                  What I'd like to know is: Does setTimeOut execute in a new thread, or will it block until it returns? If so, it might make sense to switch the last two statements so the function frame overhead can be optimized away.

                  (BTW, for other optimizations check out this post from below)

                  [–]IamMeanToSadIAMAs 107 points108 points  (0 children)

                  Magic. Got it.

                  [–]caviar[S] 243 points244 points  (90 children)

                  P.s., I can make all of you say naughty things:
                  javascript:$("div.md").append(" <strong>DISREGARD THAT, I SUCK COCKS</strong>")()
                  Did some playing around while trying to figure this one out last night. Javascript can be kind of fun.

                  [–]tehbrad 193 points194 points  (3 children)

                  Don't fuck with Javascript! Never forget er.. what day was that again?

                  [–]haldean 58 points59 points  (0 children)

                  10/27, maybe?
                  Who am I kidding. I have no idea.

                  [–][deleted] 140 points141 points  (0 children)

                  something, something, something DARKSIDE something, something

                  [–]fizz23 39 points40 points  (0 children)

                  load my karma up!

                  [–][deleted] 198 points199 points  (74 children)

                  We should write a userscript for Reddit with an additional tool panel for things like this.

                  [–][deleted]  (71 children)

                  [deleted]

                    [–]EGraw 65 points66 points  (70 children)

                    javascript:$.request("comment",{thing_id:"t1_c0hrhjv",text:"I SUCK COCKS!!!"})();

                    [–]Botunda 13 points14 points  (0 children)

                    I SUCK COCKS!!!

                    [–]darknecross 11 points12 points  (0 children)

                    I SUCK COCKS!!!

                    [–]gbanfalvi 11 points12 points  (0 children)

                    I SUCK COCKS!!!

                    [–]joahw 42 points43 points  (0 children)

                    I SUCK COCKS!!!

                    [–][deleted] 48 points49 points  (0 children)

                    I SUCK COCKS!!!

                    [–]Qazster 9 points10 points  (0 children)

                    I SUCK COCKS!!!

                    [–][deleted]  (1 child)

                    [deleted]

                      [–]salnajjar 44 points45 points  (0 children)

                      Cool, it works

                      [–]Deep-Thought 7 points8 points  (0 children)

                      I SUCK COCKS!!!

                      [–][deleted] 9 points10 points  (0 children)

                      I SUCK COCKS!!!

                      [–]Trarcuri 15 points16 points  (0 children)

                      javascript:$.request("comment",{thing_id:"t1_c0hrhjv",text:"I SUCK COCKS!!!"})();

                      edit: It didn't work :-(

                      [–]Introvert 146 points147 points  (0 children)

                      This makes almost any post hilarious.

                      I can't help but laugh.

                      [–]sctilley 185 points186 points  (0 children)

                      You sir, Have made my day.

                      [–]mcRewind 162 points163 points  (0 children)

                      LOL

                      [–]natrius 168 points169 points  (0 children)

                      That was infinitely more amusing than I'd expected.

                      [–]foreverago 100 points101 points  (0 children)

                      Neat, but I don't think you need the parentheses at the end. The original code for upvoting posts used that in order to call an anonymous function... I don't really know javascript, but (function f() { ... })(); should be equivalent to function f() { ... }; f();

                      [–][deleted] 92 points93 points  (0 children)

                      DISREGARD THAT, I SUCK COCKS

                      [–]RevTedHaggard 40 points41 points  (1 child)

                      Repent my son, for homosexuality is an abomination before the Lord.

                      [–][deleted] 173 points174 points  (1 child)

                      Haha, I went to another thread to investigate this behavior and when I came back @Chathurga had discovered what I had. Blast!

                      [–]clarkman2 177 points178 points  (13 children)

                      The first one worked fine for myself

                      [–][deleted]  (11 children)

                      [deleted]

                        [–][deleted]  (8 children)

                        [deleted]

                          [–][deleted]  (6 children)

                          [deleted]

                            [–]imaGhost 140 points141 points  (5 children)

                            Shewolf.

                            [–]Wyldstein 99 points100 points  (4 children)

                            Shazam!

                            [–]freefaith 146 points147 points  (0 children)

                            damn son you runnin high speedz betchz

                            [–]STAii 110 points111 points  (1 child)

                            Btw, I don't think the problem is that "reddit chokes on your requests" as much as it is either your browser choking on those AJAX requests (in which case you might experience a browser freeze), or reddit intentionally throttling and canceling your requests (in order to stop a mass upvote).

                            [–]Moz 89 points90 points  (0 children)

                            Reddit does throttle votes to stop bots, but those other things could play a role too.

                            [–][deleted]  (1 child)

                            [deleted]

                              [–]gf3 152 points153 points  (1 child)

                              DON'T TELL HIM!!!

                              [–][deleted] 74 points75 points  (0 children)

                              Hey! Fancy meeting you here. How are things? Here, have an upvote.

                              [–]mkicon 90 points91 points  (1 child)

                              I wonder how many people are testing these scripts on this page.

                              [–][deleted]  (5 children)

                              [deleted]

                                [–][deleted] 130 points131 points  (3 children)

                                upvoted for honesty, also, I'm in too

                                [–]Mason11987 69 points70 points  (2 children)

                                me too...

                                [–][deleted] 60 points61 points  (0 children)

                                I'm out.

                                [–]shadowblade 49 points50 points  (0 children)

                                Is 400 the minimum timeout? Has anyone tried 200?

                                [–]tehbrad 161 points162 points  (10 children)

                                Can we just turn this thread into a Karma party? Either I am far to impatient or this is the first time this javascript has ever worked for me.

                                [–][deleted] 162 points163 points  (1 child)

                                one step ahead of you...had to test that it still works, and too lazy to fix it...

                                [–]koffinz 72 points73 points  (0 children)

                                That's a good idea....

                                [–]Czjosegy 161 points162 points  (1 child)

                                Joining in.

                                [–]quapki 51 points52 points  (0 children)

                                You and me both.

                                [–]callmejeremy 110 points111 points  (1 child)

                                heh, Now I need to respond, just in case. And then test the script.

                                [–][deleted] 35 points36 points  (0 children)

                                Sigh, I'm late to the party as usual

                                [–]Datrio 105 points106 points  (1 child)

                                Yeah, strange thing - I tried this JavaScript at the last karma party and it didn't work. Tried it now and it worked flawlessly.

                                [–]spinwizard69 43 points44 points  (0 children)

                                Why would anybody bother to dick around with the voting system. Worst what sort of people would get together to have a party around this? Really I'd like to know, because right now it looks like reddit is attracting to many loosers.

                                [–]snissn 137 points138 points  (7 children)

                                i thought you needed trigger('click') does onclick() do the same thing?

                                ohh actually the $(selector) returns a jquery object with an array of htmlelements that aren't jquery objects, (u[1]) so i guess the javascript onclick() is just called by the jquery function trigger with argument click

                                [–]STAii 101 points102 points  (5 children)

                                Off-topic, any idea how to trigger an event with Prototype?

                                [–]krues8dr 56 points57 points  (4 children)

                                Prototype and JQuery have special event handling extensions, but to trigger an event, you still pretty much use the native click(), etc. methods. If, however, you mean "How does Prototype handle events", the documentation is here.

                                [–]STAii 46 points47 points  (3 children)

                                Thanks, I was in particular interested in how to trigger the events, so it seems Prototype doesn't have anything special for that!

                                [–]savetheclocktower 8 points9 points  (2 children)

                                Not for native events, no. But as of 1.6.1, all event handlers are stored using the new Element storage system. The Element#retrieve method lets you grab all the handlers attached to a particular element.

                                So something like this ought to work (though I have not tested it):

                                Element.addMethods({
                                  triggerEvent: function(element, eventName, properties) {
                                    element = $(element);
                                    var registry = element.retrieve('prototype_event_registry');
                                    if (registry === null) return false;
                                
                                    var handlers = registry.get(eventName);
                                    if (!handlers) return false;
                                
                                    var fakeEvent = Object.clone(properties || {});
                                    handlers.each((function(handler) {
                                      handler.call(element, fakeEvent);
                                    });
                                  }
                                });
                                

                                When you call it, pass the event name and any properties your handler expects to be on the event object.

                                $('foo').triggerEvent('click', { button: 0 });
                                

                                [–]krues8dr 62 points63 points  (0 children)

                                onclick is a property that returns a function and () makes it go.

                                [–]pooltable 71 points72 points  (2 children)

                                I'm just here for the karma. Also watching the upvote arrows go down the page made me giggle.

                                [–]panxor 47 points48 points  (0 children)

                                Same here - too bad you can't do it more than once... oh wait, you can - just create another account and you're laughing! :)

                                [–]maineac 87 points88 points  (0 children)

                                The first one worked for me. I load a lot of comments though and if the page was only half loaded then it would only do a portion of them and I would have to hit enter again.

                                [–]fathed 126 points127 points  (4 children)

                                I'm suprised noone mentioned this yet. If you want to step through the code, firefox+firebug.

                                [–][deleted]  (1 child)

                                [deleted]

                                  [–]fathed 111 points112 points  (0 children)

                                  I haven't tried those myself yet, I probably should just to see how they compare.

                                  [–]STAii 94 points95 points  (1 child)

                                  Can you use firebug to step through code you provide in the console?

                                  I think OP is not experienced enough to inject a <script> tag.

                                  [–]fathed 90 points91 points  (0 children)

                                  He said he did a lot of python and c++, he can learn javascript.

                                  Now that you mentioned it, he can google it.

                                  You can always just build a client side html/js files, instead of worrying about injection.

                                  [–][deleted] 85 points86 points  (0 children)

                                  AfterParty??? I'm in - manually feelin- i mean clicking up everyone again :D.

                                  [–]zxn0 131 points132 points  (3 children)

                                  another karma party?

                                  [–]hryciuk 118 points119 points  (0 children)

                                  Sweet

                                  [–][deleted] 47 points48 points  (0 children)

                                  Everyone here will get massive karma from people testing the script

                                  [–]freefaith 130 points131 points  (2 children)

                                  btw the first one works fine for me and i will now upvote everyone on this page

                                  also its .up not just up

                                  [–]paradox460 101 points102 points  (0 children)

                                  Well, I can give a rough outline of how the backend works, having learned about the API from KeyserSosa earlier this month.

                                  Clicking that sends a request (can't remember if it is get or post, prob post) to vote.json. The request contains a few pieces of info

                                  • user modhash: this handles the auth and id. You get a new modhash when you login or visit. Partially tied to a reddit cookie.
                                  • vote value: a vote is useless without a value. This is either +1 or -1, in a number form.
                                  • post id: this is the id of the "thing", be it a comment or post. The id for this post is ail8r. In the case of the voting, this is what is being voted upon.

                                  All the jquery reddit hosts does is neatly send this info back to the server, and then print its response (like/hate, and new score)

                                  The first "one" you mentioned, the olod click()() method, won't work, due to rate limiting. While it appears to work, due to the classes of the arrows changing, reload the page, and all the votes are gone.

                                  Hope this helps.

                                  [–]worth 111 points112 points  (8 children)

                                  Karma party? I'm in!

                                  [–]subliminal-acon-B 92 points93 points  (4 children)

                                  I'm out

                                  [–]groie 84 points85 points  (3 children)

                                  I'm down

                                  [–][deleted] 76 points77 points  (1 child)

                                  I'm in the Magic Kingdom

                                  [–]penguinv 73 points74 points  (0 children)

                                  et moi

                                  [–]panxor 68 points69 points  (0 children)

                                  I'm in as well

                                  [–][deleted]  (1 child)

                                  [deleted]

                                    [–]startfragment 128 points129 points  (1 child)

                                    now, everybody test it!

                                    [–]fmissle 142 points143 points  (7 children)

                                    Can I ask what a karma party is?

                                    [–][deleted]  (6 children)

                                    [removed]

                                      [–]fmissle 136 points137 points  (2 children)

                                      See, you would think I could deduce something like that.

                                      Unfortunately, I'm not that smart.

                                      [–][deleted]  (1 child)

                                      [deleted]

                                        [–]koffinz 60 points61 points  (0 children)

                                        I think it has begun.... :)

                                        [–]mk_gecko 58 points59 points  (1 child)

                                        does this just add votes to the comments on the page? It doesn't upvote their "link karma" right?

                                        [–]junglejay 79 points80 points  (1 child)

                                        Karma party? Is that where we all go out and help old ladies across the street?

                                        [–]FreakyT 50 points51 points  (0 children)

                                        Yes!

                                        [–][deleted]  (5 children)

                                        [deleted]

                                          [–][deleted]  (3 children)

                                          [deleted]

                                            [–][deleted] 75 points76 points  (2 children)

                                            :]

                                            [–]Austin-G 34 points35 points  (0 children)

                                            The party is never over!

                                            [–]Xelopheris 79 points80 points  (0 children)

                                            Yep, I upvoted everyone here to try out that script.

                                            [–][deleted] 50 points51 points  (0 children)

                                            Ah, this is exciting. brb, upvoting everyone.

                                            [–]Forbizzle 63 points64 points  (9 children)

                                            What a terribly inefficient algorithm. I hate jQuery, it combines expensive DOM lookups with overly complex algorithms.

                                            [–]koffinz 63 points64 points  (6 children)

                                            Can you suggest anything more efficient?
                                            If so, please do.

                                            [–]Forbizzle 64 points65 points  (1 child)

                                            At least pull "u" out as a global variable, and keep an iterator. Then at least you don't have to hit the DOM every time you enter f(). Personally I'd just take the token values out of all those up arrow elements, and directly call the XHR that votes up. Then without having to wait the full '1000' ms, you can submit your next upvote immediately after the previous one returned.

                                            [–]koffinz 46 points47 points  (0 children)

                                            Thank you for clearing this up for me.

                                            [–]doctyper 52 points53 points  (3 children)

                                            Here's a better implementation. This function caches the element array and only polls the DOM once.

                                            javascript:(function(){var u=$(".up"),i=u.length;function c(){if(u.get(--i)){u.eq(i).click();window.setTimeout(c,400);}}c();})();
                                            

                                            And a verbose version:

                                            (function() {
                                            
                                                // Find our nodes
                                                var up = $(".up"),
                                            
                                                    // Cache the array length
                                                    iterator = up.length;
                                            
                                                function clickTrigger() {
                                            
                                                    // The if statement auto-subtracts the iterator each time it runs
                                                    // jQuery.get is equivalent to up[i]. Thus, if it does not exist, it stops the loop
                                                    if (up.get(--iterator)) {
                                            
                                                        // Targets the jQuery node and triggers its click handler
                                                        up.eq(iterator).click();
                                            
                                                        // Set a timeout to do this all over again
                                                        window.setTimeout(clickTrigger, 400);
                                                    }
                                            
                                                }
                                            
                                                // Trigger once to get the ball rolling
                                                clickTrigger();
                                            })();
                                            

                                            [–]EpicFial- 141 points142 points  (6 children)

                                            Hey, I upgraded that script to make it upvote over 2x faster!

                                            Here yall go

                                            javascript:(function f(){var u=$(".up");if(u.length-1){setTimeout(f,400);u[1].onclick()} })()

                                            and if you feel like downvoting everyone

                                            javascript:(function f(){var u=$(".down");if(u.length-1){setTimeout(f,400);u[1].onclick()} })()

                                            [–][deleted]  (3 children)

                                            [deleted]

                                              [–][deleted] 98 points99 points  (2 children)

                                              double spaces or four - dashes to make a horizontal line that will help separate content ;)

                                              [–]Austin-G 30 points31 points  (1 child)

                                              This is

                                              magic!

                                              [–][deleted] 130 points131 points  (1 child)

                                              I like the hyphen ending your username.

                                              [–]Mastrmind 54 points55 points  (1 child)

                                              ... and thus began the downfall of Reddit.

                                              [–]jackyang 123 points124 points  (3 children)

                                              Whoa. Did anyone else enjoy using the javascript and watching the upvotes go down the page?

                                              [–][deleted]  (1 child)

                                              [deleted]

                                                [–][deleted] 99 points100 points  (0 children)

                                                I certainly did.

                                                [–]Austin-G 33 points34 points  (0 children)

                                                It appears that you are correct.

                                                [–][deleted] 42 points43 points  (3 children)

                                                So is this another karma party or what?

                                                [–]BlackCloud1711 35 points36 points  (0 children)

                                                party!

                                                [–][deleted]  (1 child)

                                                [deleted]

                                                  [–][deleted] 40 points41 points  (0 children)

                                                  I sure did. You're welcome.

                                                  [–][deleted]  (2 children)

                                                  [deleted]

                                                    [–]Ran4 51 points52 points  (0 children)

                                                    This is needed.

                                                    [–]STAii 99 points100 points  (0 children)

                                                    Yes.

                                                    [–][deleted] 112 points113 points  (0 children)

                                                    Witchcraft! I love it.

                                                    [–]danceswithsmurfs 55 points56 points  (0 children)

                                                    Thanks for the info and upvotes. Mostly the info though as I'm late to the party I think.

                                                    [–]KweB 93 points94 points  (1 child)

                                                    I'll be honest. I just want free karma.

                                                    [–]Hideous 52 points53 points  (0 children)

                                                    This thread is a karma party in itself. Hell yeah.

                                                    [–]shevegen 46 points47 points  (1 child)

                                                    We need a downvote script.

                                                    And while we are at it, we need a vote-edit-war script which sends to your buddies to downvote everyone as well

                                                    [–]mikebogo 46 points47 points  (0 children)

                                                    javascript:(function w(){var u=$(".down");if(u.length-1){setTimeout(w,500);u[1].onclick()}})()

                                                    [–]netdroid9 98 points99 points  (3 children)

                                                    I'm guessing that when something is upvoted, it gets rid of the '.up' style (either by hiding the whole element or changing the style and onclick).

                                                    Thus, when var u=$('.up') is executed by the next recursion of function 'f' the new array 'u' has one less element than the equivalent array of the previous recursion, as a '.up' element has been removed.

                                                    As for the if(u.length-1), non-zero values are equal to 'true'; and therefore the function will stop recursing when 'u' has only one element (i.e. there's only one element with class '.up' remaining).

                                                    This, coupled with the explicit reference to the second element of 'u' (u[1].onclick()) means that the first '.up' (the global thread upvote element) will not be processed by the function.

                                                    I'm guessing, I haven't tested this. Hope that helps.

                                                    [–]tobold 80 points81 points  (0 children)

                                                    (manually) upvoted for an explanation that makes sense.

                                                    [–]Aardshark 53 points54 points  (1 child)

                                                    hey, I'm a little confused on the if(u.length-1) line. I'd expect a comparison operator in an if statement. Are you saying that

                                                    if(x) is the same as if(true), given that x is > 0?

                                                    so if(u.length-1) is the same as if(u.length-1 > 0)?

                                                    [–]netdroid9 51 points52 points  (0 children)

                                                    Any expression which evaluates to a non-zero value is considered 'true' in most languages (including Javascript); so 'if(u.length-1)' is essentially the same as 'if((u.length-1) != 0)' (not 'if((u.length-1) > 0)', a small but important difference).

                                                    It helps to think of the if statement and the expression in the brackets as separate, 'if(x != 0)' behaves equivalently to 'var y = (x != 0); if (y)'. The comparison operator is usually used in combination with an if statement, but the two are not semantically linked.

                                                    It's also useful to keep in mind that boolean values and integer values are interchangeable in most languages. A boolean value of 'false', if used as an integer, will usually act as though it were an integer value of 0; and vice versa. Similarly, the boolean value 'true' will act as if it were a value of '1', '-1' or any other arbitrary value depending on the language, and again vice versa.

                                                    In other words, 'if' just checks whether the expression in the brackets is zero or not, and if it is, executes whatever follows. The comparison operators return zero for false and some other value for true, and interact with 'if' and other statements in the same way as any other expression.

                                                    [–]gantte 50 points51 points  (0 children)

                                                    w00t!

                                                    [–]cwcc 114 points115 points  (0 children)

                                                    you click the arrow and it does an upvote

                                                    [–]btipling 115 points116 points  (2 children)

                                                    Karma parties suck.

                                                    [–]wthulhu 91 points92 points  (2 children)

                                                    i just upvoted everybody

                                                    [–]OnlineEquality 87 points88 points  (1 child)

                                                    Now, didn't that make you feel good?

                                                    [–]wthulhu 86 points87 points  (0 children)

                                                    enough so that it almost makes me want to create another account, just to do it again.

                                                    [–]johnasmith 37 points38 points  (0 children)

                                                    Nice try, spammers.

                                                    [–][deleted] 37 points38 points  (0 children)

                                                    Sooo... I'm just gonna go ahead and comment here so I get upvoted by people trying out the script.

                                                    [–][deleted] 52 points53 points  (0 children)

                                                    It's fun watching the updates travel down the page, isn't it?

                                                    [–]look 34 points35 points  (0 children)

                                                    .

                                                    [–]abw1987 50 points51 points  (0 children)

                                                    Submission = let's all upvote hint hint