Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: mojombo/clippy
base: master
...
head fork: xuanxu/clippy
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 6 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 18 additions and 6 deletions.
  1. +13 −3 README.md
  2. BIN  build/clippy.swf
  3. +5 −3 clippy.hx
View
16 README.md
@@ -6,10 +6,14 @@ text onto the client's clipboard. Here is what Clippy looks like on GitHub:
![Clippy in action](http://img.skitch.com/20090213-cjiawnwig8udf5a6qf1c45cne8.png)
+All texts on Clippy are set via params so it is suitable for I18n.
+
Here is a sample Rails (Ruby) helper that can be used to place Clippy on a
page:
- def clippy(text, bgcolor='#FFFFFF')
+ def clippy(text, copytext, copiedtext, bgcolor='#FFFFFF')
+ copytext ||= "copy to the clipboard"
+ copiedtext ||= "copied!"
html = <<-EOF
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
width="110"
@@ -19,7 +23,7 @@ page:
<param name="allowScriptAccess" value="always" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
- <param NAME="FlashVars" value="text=#{text}">
+ <param NAME="FlashVars" value="text=#{text}&copytext=#{copytext}&copiedtext=#{copiedtext}">
<param name="bgcolor" value="#{bgcolor}">
<embed src="/flash/clippy.swf"
width="110"
@@ -29,12 +33,18 @@ page:
allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
- FlashVars="text=#{text}"
+ FlashVars="text=#{text}&copytext=#{copytext}&copiedtext=#{copiedtext}"
bgcolor="#{bgcolor}"
/>
</object>
EOF
end
+
+The method sets via Flashvars three parameters:
+
+* text: The text to be copied to the clipboard
+* copytext: The text to appear next to the icon before it is clicked
+* copiedtext: The text to show once the user clicks on the icon
Installation (Pre-Built SWF)
---------------------------
View
BIN  build/clippy.swf
Binary file not shown
View
8 clippy.hx
@@ -9,13 +9,15 @@ class Clippy {
// Main
static function main() {
var text:String = flash.Lib.current.loaderInfo.parameters.text;
+ var copytext:String = flash.Lib.current.loaderInfo.parameters.copytext;
+ var copiedtext:String = flash.Lib.current.loaderInfo.parameters.copiedtext;
// label
var label:TextField = new TextField();
var format:TextFormat = new TextFormat("Arial", 10);
- label.text = "copy to clipboard";
+ label.text = copytext;
label.setTextFormat(format);
label.textColor = 0x888888;
label.selectable = false;
@@ -35,7 +37,7 @@ class Clippy {
button.addEventListener(MouseEvent.MOUSE_UP, function(e:MouseEvent) {
flash.system.System.setClipboard(text);
- label.text = "copied!";
+ label.text = copiedtext;
label.setTextFormat(format);
});
@@ -45,7 +47,7 @@ class Clippy {
button.addEventListener(MouseEvent.MOUSE_OUT, function(e:MouseEvent) {
label.visible = false;
- label.text = "copy to clipboard";
+ label.text = copytext;
label.setTextFormat(format);
});

No commit comments for this range

Something went wrong with that request. Please try again.