Skip to content

Instantly share code, notes, and snippets.

@to
Created December 15, 2008 13:34
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 to/35955 to your computer and use it in GitHub Desktop.
Save to/35955 to your computer and use it in GitHub Desktop.
var tomb = Components.classes['@brasil.to/tombloo-service;1'].getService().wrappedJSObject;
var ctx = _jsaCScript.context;
if(ctx.onImage){
var src = ctx.target.src;
var name = prompt('Source String');
} else {
var name = trim(ctx.selection);
var string = prompt('Destination String');
}
new tomb.Wedata.Item('Motsu', name, {
image_url : src,
string : string,
}).save();
// ----[Utility]-------------------------------------------------
function trim(str){
return ('' + str).replace(/^\s+|\s+$/g, '');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment