Skip to content

Instantly share code, notes, and snippets.

@yrgoldteeth
Created July 29, 2013 21:27
Show Gist options
  • Save yrgoldteeth/6108013 to your computer and use it in GitHub Desktop.
Save yrgoldteeth/6108013 to your computer and use it in GitHub Desktop.
// 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