Skip to content

Instantly share code, notes, and snippets.

@jcottrell
Created November 28, 2011 20:54
Show Gist options
  • Select an option

  • Save jcottrell/1402001 to your computer and use it in GitHub Desktop.

Select an option

Save jcottrell/1402001 to your computer and use it in GitHub Desktop.
Simple copy example via clippy
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<title>Copy Gist</title>
</head>
<body>
Type here then focus-off<br>
<input type="text" /><span id="fl_wrap"></span><br>
<script>
$('input').focusout(function() {
var ct = $(this).val(),
fl_copy = '<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=#{text}"><param name="bgcolor" value="#ffffff"><embed src="clippy.swf" width="110" height="14" name="clippy" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="text=#{text}" bgcolor="#ffffff" /></object>';
$('#fl_wrap').html(fl_copy.replace(/#\{text\}/g,ct));
}).focusin(function(){
if ($('#fl_wrap').length > 0) {
$('#fl_wrap').children().remove();
}
});
</script>
<br><br>
Paste area for convenience:<br>
<textarea></textarea>
</body>
</html>
@jcottrell
Copy link
Author

Assumes the popular clippy open source flash tool is in the same directory (obviously).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment