Skip to content

Instantly share code, notes, and snippets.

@KushalP
Last active August 29, 2015 13:56
Show Gist options
  • Save KushalP/9306626 to your computer and use it in GitHub Desktop.
Save KushalP/9306626 to your computer and use it in GitHub Desktop.
Bookmarklet that replaces uses of IL0...IL9 with random colours of the rainbow.
// Paste the below into your address bar where the "Impact Level" acronym is used.
javascript:function replaceILUse(){function randomRainbowColour(){return ["Red","Orange","Yellow","Green","Blue","Indigo","Violet"].sort(function(){return 0.5-Math.random()})[0]}function rainbowMatcher(match,p1,offset,string){return randomRainbowColour()}var original=document.body.innerHTML;document.body.innerHTML=original.replace(/IL[0-9]/ig,rainbowMatcher)}replaceILUse();
function replaceILUse() {
function randomRainbowColour() {
return ["Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet"].
sort(function() { return 0.5 - Math.random(); })[0];
}
function rainbowMatcher(match, p1, offset, string) {
return randomRainbowColour();
}
var original = document.body.innerHTML;
document.body.innerHTML = original.replace(/IL[0-9]/ig, rainbowMatcher);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment