Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
(function($) {
$.fn.clippy = function(text, bgcolor) {
if (!bgcolor) {
var node = $(this);
while (node.css('background-color') == 'transparent' && node.length) {
node = node.parent();
if (!node.length) {
bgcolor = '#ffffff';
} else {
bgcolor = node.css('background-color');
var m = bgcolor.match(/^rgb\(\s*(\d+),\s*(\d+)\s*,\s*(\d+)\s*\)$/i)
if (m) {
var r = parseInt(m[1], 10),
g = parseInt(m[2], 10),
b = parseInt(m[3], 10);
bgcolor = '#'+r.toString(16)+g.toString(16)+b.toString(16);
.after($('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="110" height="14" id="clippy"> <param name="movie" value="/clippy.swf"/> <param name="allowScriptAccess" value="always" /> <param name="quality" value="high" /> <param name="scale" value="noscale" /> <param NAME="FlashVars" value="text='+escape(text)+'> <param name="bgcolor" value="'+bgcolor+'"> <embed src="/clippy.swf" width="110" height="14" name="clippy" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="" FlashVars="text='+escape(text)+'" bgcolor="'+bgcolor+'" /> </object>'))

Was it harв ещ add small usage example. Lost 20 minuts trying to use it. Not every one is very smart. There are some beginners.


@Serhioromano: How about sharing your results? Thank you!


Yes, is there somewhere a demo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.