Clippy is a very simple Flash widget that makes it possible to place arbitrary text onto the client's clipboard.
Ruby Haxe
Switch branches/tags
Nothing to show
Pull request Compare This branch is 14 commits ahead of mojombo:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
assets first commit Feb 13, 2009
Makefile add Makefile ; rename clippy.hx to Clippy.hx Jul 4, 2009 jQuery-enabled, button-only Clippy. Nov 27, 2010

jQuery-enabled Clippy - Helping you copy text to your clipboard

Source Code: Modified By: Andrey Tarantsov Based On:

This version of Clippy makes friends with (and requires) jQuery. Only the button is displayed; showing “copy to clipboard” and “copied!” texts is up to the user.

Here's the code I use to insert Clippy:

var $copy = $('#copy-button'), $copyLabel = $('#copy-button-label');
  'clippycopy': function(e, data) {
    data.text = getRunURL();
  'clippyover': function() {
    $copyLabel.html("copy to clipboard");
  'clippyout': function() {
  'clippycopied': function() {

Clippy accepts a single FlashVar called target and uses $.trigger to trigger the following events on it: clippycopy (return the text to copy), clippyover (button hovered), clippyout (button unhovered), clippycopied (button clicked).

Here is the jQuery plugin:

$.fn.clippy = function(url) {
  return $(this).embedflash({
    width: 14,
    height: 14,
    url: url,
    vars: {
      target: this.selector

$.fn.embedflash = function(options) {
  var vars = (function() {
    var result = [], _vars = options.vars || {}, k;
    for (k in _vars) {
      if (!_vars.hasOwnProperty(k)) continue;
      result.push("" + (escape(k)) + "=" + (escape(_vars[k])));
    return result;
  return $(this).html("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"" + (options.width) + "\" height=\"" + (options.height) + "\"> <param name=\"movie\" value=\"" + (escape(options.url)) + "\"/> <param name=\"allowScriptAccess\" value=\"always\" /> <param name=\"quality\" value=\"high\" /> <param name=\"wmode\" value=\"transparent\"/> <param name=\"scale\" value=\"noscale\" /> <param name=\"FlashVars\" value=\"" + (vars) + "\"> <embed src=\"" + (escape(options.url)) + "\" width=\"" + (options.width) + "\" height=\"" + (options.height) + "\" quality=\"high\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"\" FlashVars=\"" + (vars) + "\" wmode=\"transparent\" /> </object>");

This code has actually been compiled from the following CoffeeScript:

  'clippycopy':   (e, data) ->  data.text = getRunURL()
  'clippyover':   ->            $copyLabel.html "copy to clipboard"
  'clippyout':    ->            $copyLabel.html ""
  'clippycopied': ->            $copyLabel.html "copied!"

$.fn.clippy = (url) ->
  this.embedflash width: 14, height: 14, url, vars: { target: @selector }

$.fn.embedflash = (options) ->
  { width, height, url } = options  # mandatory

  vars = ("#{escape(k)}=#{escape(v)}" for k, v of options.vars || {}).join("&")

  this.html("""<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="#{width}" height="#{height}"> <param name="movie" value="#{escape(url)}"/> <param name="allowScriptAccess" value="always" /> <param name="quality" value="high" /> <param name="wmode" value="transparent"/> <param name="scale" value="noscale" /> <param name="FlashVars" value="#{vars}"> <embed src="#{escape(url)}" width="#{width}" height="#{height}" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="" FlashVars="#{vars}" wmode="transparent" /> </object>""")

Installation (Pre-Built SWF)

If you want to use Clippy unmodified, just copy build/clippy.swf to your public directory or wherever your static assets can be found.

Installation (Compiling)

In order to compile Clippy from source, you need to install the following:

The haXe code is in clippy.hx, the button images are in assets, and the compiler config is in compile.hxml. Make sure you look at all of these to see where and what you'll need to modify. To compile everything into a final SWF, run the following from Clippy's root directory:

swfmill simple library.xml library.swf && haxe compile.hxml

If that is successful, copy build/clippy.swf to your public directory or wherever your static assets can be found.

Please note that I haven't been able to build a working SWF using haXe 2.06 on OS X. Using haXe 2.05 works fine.


If you'd like to hack on Clippy, start by forking my repo on GitHub:

The best way to get your changes merged back into core is as follows:

  1. Clone down your fork
  2. Create a topic branch to contain your change
  3. Hack away
  4. If you are adding new functionality, document it in
  5. If necessary, rebase your commits into logical chunks, without errors
  6. Push the branch up to GitHub
  7. Send me (mojombo) a pull request for your branch


MIT License (see LICENSE file)