Created
July 29, 2013 21:27
-
-
Save yrgoldteeth/6108013 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Original from: http://labs.tannr.com/projects/herpderp/herp.js | |
// Replace all comments on al.com with various permutations on "herp" and "derp" | |
function randomDerp() { | |
this.derpOriginal = $(this).html(); | |
$(this).click(function() { | |
$(this).html(this.derpOriginal); | |
}); | |
var randomLength = (Math.floor(Math.random()*20)+1); | |
var wordArray = new Array(); | |
for(var x = 0; x < randomLength; x++) { | |
randomBit = (Math.floor(Math.random()*2)); | |
if(randomBit == 1) { | |
wordArray[x] = 'herp'; | |
} else { | |
wordArray[x] = 'derp'; | |
} | |
} | |
// add derped class | |
$(this).addClass("derped"); | |
return '<p>' + wordArray.join(' ') + '</p>'; | |
} | |
// only select un-derped elements | |
$('.echo-item-text').not('.derped').html(randomDerp); | |
setInterval(function() { | |
// only select un-derped elements | |
$('.echo-item-text').not('.derped').html(randomDerp); | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment