Created
September 11, 2012 00:32
-
-
Save kenany/3695071 to your computer and use it in GitHub Desktop.
Herp Derp YouTube Comments (CoffeeScript edition)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# labs.tannr.com/projects/herpderp/herp.js | |
randomDerp = -> | |
@derpOriginal = $(@).html() | |
$(@).click -> | |
$(@).html @derpOriginal | |
randomLength = Math.floor(Math.random() * 20) + 1 | |
wordArray = new Array | |
x = 0 | |
while x < randomLength | |
randomBit = Math.floor(Math.random() * 2) | |
if randomBit is 1 | |
wordArray[x] = 'herp' | |
else | |
wordArray[x] = 'derp' | |
x++ | |
$(@).addClass 'derped' | |
"<p>#{ wordArray.join(' ') }</p>" | |
$('.comment-text, p.ctx').not('.derped').html randomDerp | |
setInterval -> | |
$('.comment-text, p.ctx').not('.derped').html randomDerp | |
, 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment