Skip to content

Instantly share code, notes, and snippets.

@10sr
Created January 18, 2010 07:17
Show Gist options
  • Save 10sr/279852 to your computer and use it in GitHub Desktop.
Save 10sr/279852 to your computer and use it in GitHub Desktop.
identi.ca from ks俺用
function (aEvent) {
prompt.read("identi.ca:", function (aStatus) {
var password;
var username = "10sr";
var passwordManager = (Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager));
var logins = passwordManager.findLogins({},
"http://identi.ca", "", null);
for (var i = 0; i < logins.length; i++) {
if (logins[i].username == username) {
password = logins[i].password;
break;
}
}
var xhr = new XMLHttpRequest;
xhr.open("POST", "http://identi.ca/api/statuses/update.json", false, username, password);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("status=" + aStatus);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment