Created
July 24, 2009 10:22
-
-
Save prasincs/153954 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*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: "[email protected]"}, | |
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