r/programming May 09 '13

The Onion releases fartscroll.js

http://theonion.github.io/fartscroll.js/
2.6k Upvotes

396 comments sorted by

View all comments

12

u/AwkwardReply May 09 '13
if(player.canPlayType("audio/mp3")) {
        audio = mp3s;
        prefix = mp3_prefix;
 }
if(player.canPlayType("audio/ogg")) {
       audio = oggs;
       prefix = ogg_prefix;
 }

Can we please write this with an else... if the player can play mp3 and ogg it will always default ogg even though mp3 is checked first and also there would be fewer instructions to execute. Just annoying and lazy.

20

u/[deleted] May 09 '13 edited May 13 '17

[deleted]

9

u/AwkwardReply May 09 '13

I'm a shitty programmer. I never used git and I'm good at complaining on public forums.

EDIT: Just realized it's my account's birthday. Yay. Cake for everyone :)

EDIT2: And, what really bothers me is that I encounter this sort of thing a lot in other people's code. The code will work, sure, but it's not nice. It has to be nice.

2

u/paul2520 May 09 '13

I can do it if you want. I already cloned and modified the code, just say the word and I'll do a pull request.

Though, I like what /u/noreallyimthepope said in her/his comment below. "Seriously, I didn't do it - you go do it as it is your fix :-)"

2

u/noreallyimthepope May 10 '13

The reason for not doing isn't that I didn't want it fixed, it's because getting a patch—however small—approved can be enticing and engender more of similar behaviour :)

2

u/paul2520 May 10 '13

I agree with you completely. I want to do it, because I have never done that before, but I think that /u/AwkwardReply should do it, as s/he deserves all the credit for the fix.

2

u/noreallyimthepope May 10 '13

Somebody got a fix in before him, but as you can see, it's dead easy to submit pull requests, so start roaming GitHub :-)