I demonstrated this at my jQuery presentation earlier today at CFUNITED but I thought I'd share the code. The basic idea is this - you have a coworker you hate (we've all had one from time to time), so you quickly figure out their IP and output some code just for them:

<html>

<head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script src="myplugin.js"></script> <script> <cfif cgi.remote_host is "127.0.0.1"> function mean() { $("#content").notMean(); }

$(document).ready(function () { window.setInterval('mean()',5000) }) </cfif> </script> </head>

<body>

<div id="content"> This is my text. It is only my text. It does not have anything special in it. You should not read it. </div>

</body> </html>

What does the 'notMean' plugin do? I think a video demonstration may be a bit nicer.



Be sure to watch the entire thing - it is a bit subtle. So I don't imagine anyone would ever use this in production (but if you do, let me know), but here is the source code:

$.fn.notMean = function(){ this.each( function(){ var contents = $(this).html() var ranPos = Math.ceil(Math.random() * contents.length) var ranChar = Math.ceil(Math.random() * 26) + 65 var newChar = String.fromCharCode(ranChar) if(Math.random() > 0.5) newChar = newChar.toLowerCase() var newContents = contents.substring(0,ranPos) + newChar + contents.substring(ranPos+1,contents.length) $(this).html(newContents) } )

return this }

Enjoy!