Skip to content

Instantly share code, notes, and snippets.

@prasincs
Created July 24, 2009 10:22
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 prasincs/153954 to your computer and use it in GitHub Desktop.
Save prasincs/153954 to your computer and use it in GitHub Desktop.
/*A script to update friendfeed status */
CmdUtils.CreateCommand({
names: ["friendfeed","ff"],
icon: "http://www.friendfeed.com/favicon.ico",
description: "Update your friendfeed status. Remember you need to give your API key from http://friendfeed.com/api",
help: "friendfeed \"status you want to put\"",
author: {name: "Prasanna Gautam", email: "you@mozilla.com"},
license: "MIT",
homepage: "http://nextdoorhacker.com",
arguments: [{role: 'object', nountype: noun_arb_text}],
preview: function preview(pblock, args) {
pblock.innerHTML = "Your status will be <b>" + args.object.html + "</b>.";
},
execute: function execute(args) {
var statusText = args.object.text;
if(statusText.length < 1) { displayMessage("FriendFeed requires a post to be entered");
return;
}
var updateUrl = "http://friendfeed.com/api/share";
var updateParams = { title: statusText };
jQuery.ajax({ type: "POST",
url: updateUrl,
data: updateParams,
dataType: "json", error: function() {
displayMessage("FriendFeed error - not posted");
},
success: function() { displayMessage("Posted to FriendFeed");
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment