Skip to content

Instantly share code, notes, and snippets.

@tonetheman
Created August 28, 2008 15:09
Show Gist options
  • Save tonetheman/7738 to your computer and use it in GitHub Desktop.
Save tonetheman/7738 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand(
{
name : "delicious",
author: { name : "Tonetheman", homepage: "http://tryexceptfinally.blogspot.com"},
license: "MPL",
execute : function() {
var doc = Application.activeWindow.activeTab.document;
var updateUrl = "https://api.del.icio.us/v1/posts/add";
var updateParams = {
url: doc.documentURI,
description: doc.title
};
jQuery.ajax({
type: "POST",
url: updateUrl,
data: updateParams,
dataType: "xml",
error: function() {
displayMessage("del.icio.us - link updated - ");
},
success: function(data, textStatus) {
if (data.firstChild.attributes.code.value == "done") {
displayMessage("del.icio.us - linked posted");
} else {
displayMessage("del.icio.us - problem with post");
}
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment