Skip to content

Instantly share code, notes, and snippets.

@achimbode
Created February 20, 2009 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achimbode/67576 to your computer and use it in GitHub Desktop.
Save achimbode/67576 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
name: "copytest",
icon: "http://vfh30.tfh-berlin.de/4c4m/favicon.ico",
homepage: "http://www.achimbo.de/",
author: { name: "Achim Bode", email: "achimbode@gmx.net"},
license: "MPL",
description: "Wat dat ding macht (desription)",
help: "Wie man dat anwendet (how to use your command)",
takes: {"input": noun_arb_text},
_copy: function( copytext ) {
const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].
getService(Components.interfaces.nsIClipboardHelper);
gClipboardHelper.copyString("Put me on the clipboard, please.");
}
preview: function( pblock, input ) {
var template = "Hello ${name}";
pblock.innerHTML = CmdUtils.renderTemplate(template, {"name": "World!"});
},
execute: function(input) {
this._copy( input.html );
CmdUtils.setSelection("You selected: "+input.html);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment