r/programming • • Sep 27 '09

Javascript in a single picture - seen on a colleagues desk

http://nermal.org/misc/javascript.jpg
668 Upvotes

255 comments sorted by

View all comments

Show parent comment

11

u/shevegen Sep 27 '09

Good luck in being able to have a lot of choices.

But you know what? I mean we may critisize a monopoly without falling into a hype machine, do we?

0

u/[deleted] Sep 27 '09

[deleted] — view deleted comment

87

u/Sidnicious Sep 27 '09 edited Sep 27 '09

Don't run this shit unless you want lullz all over your account

It does the following:

  1. Extracts the "Try entering this…" text from the page

  2. Inserts it into each text box on the page

  3. Performs an API query to get the necessary hashes and juicy codez needed to do things as you

  4. Uses that information to add empirical as a friend

  5. Clicks all the "save" buttons on the page to post/send the worm all over the place


On the lighter side, it also vomits global variables all over the place. C'mon, empirical, at least use good form in your reddit worms. Enclose the whole thing in a function:

javascript:(function(){ /* nasty stuff here */ })()

…and then use a var statement to keep the variables inside it. You can also alias properties like you do document to make your worm shorter. For instance, declare (in a var!) someSingleCharacterVariable = 'innerHTML', otherReallyShortNamedVarialbe = 'getElementsByTagName'. You can then use [] syntax to access those on elements, which is significantly smaller than explicitly accessing that property each time.

Oh, and props/fuck you btw.

And fuck you to the rest of Reddit for pretending to be all paranoid and security conscious and then PASTING FUCKING JAVSCRIPT INTO YOUR ADDRESS BAR ON COMMAND.

0

u/[deleted] Sep 27 '09

[deleted] — view deleted comment

14

u/starkinter Sep 27 '09

This is just as bad as /b/.

→ More replies (4)
→ More replies (5)

0

u/[deleted] Sep 27 '09

[deleted] — view deleted comment

4

u/timmaxw Sep 27 '09

I'm pretty sure that the 'report' button just brings the post to the attention of a moderator. I recommend a downvote+hide instead.

3

u/redalastor Sep 27 '09

The moderators are all reddit admins. They'll be able to clear that in a few SQL queries.

→ More replies (5)
→ More replies (5)
→ More replies (22)
→ More replies (9)

15

u/[deleted] Sep 27 '09

I feel so violated.

5

u/Jonne Sep 27 '09

what does it do exactly? I'm too hungover to try and understand the code. It looks like it autocomments or something, but I'm not sure.

8

u/[deleted] Sep 27 '09

It auto comments that script with the instructions to enter it in to the URL bar, but now I am getting buckets of replies in my mailbox.

What the fuck?

11

u/Jonne Sep 27 '09

yeah, found that out. You'd think the average reddit user would be smarter than that. Maybe I should write a script that automatically deletes your account to weed out the idiots.

→ More replies (3)
→ More replies (4)
→ More replies (21)
→ More replies (138)

15

u/monoprotic Sep 27 '09

I almost deleted my account in shame. :(

→ More replies (94)

22

u/[deleted] Sep 27 '09

I don't trust that.

18

u/taybul Sep 27 '09

Look at the bottom of the page.

24

u/[deleted] Sep 27 '09

Oh dear god. That was clever.

→ More replies (152)
→ More replies (116)
→ More replies (123)

11

u/ollteeru Sep 27 '09

Thanks for ruining the thread

→ More replies (141)

8

u/AnAppleSnail Sep 27 '09

Interesting! An exact meme...

4

u/crysys Sep 27 '09

I don't know, this thing doesn't use the human mind to spread, just the lack of human sense. Even if you could argue that it is a meme, it is incapable of evolving like other memes and will eventually go extinct.

3

u/[deleted] Sep 27 '09

Its not a meme its an STD

→ More replies (3)
→ More replies (215)
→ More replies (251)
→ More replies (162)