Created
August 28, 2008 15:09
-
-
Save tonetheman/7738 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
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