Hello everybody, I think ubiquity is great, after using it for just a
few days I've realized how much I would like to have other commands
available, and it doesn't *seem* so hard. As I use identi.ca I would
like to have a command to post to identi.ca the same way it is
possible to share something on twitter. By now I am creating the
noun_type_identica_user I would have asked in a regular javascript
forum, but I think this question may be related with ubiquity or
firefox, I have never used firebug nor anything like this, I'm a
complete noob, so any tips about debugging are welcome too. I'm
pasting the code with the part that gives me problems, search for @@@
Thank you alll.
var noun_type_identica_user = {
label: "user",
rankLast: true,
noExternalCalls: true,
suggest: function nt_idcauser_suggest(text, html, cb, selected) {
// reject text from selection.
if (!text || selected)
return [];
var foundAt = (text[0] == '@');
if (foundAt) text = text.slice(1); // strip off the @
var suggs = CmdUtils.grepSuggs(text, logins);
// only letters, numbers, and underscores are allowed in twitter
// usernames.
if (/^[a-z0-9]{1,64}$/.test(text))
suggs.push(CmdUtils.makeSugg(text, text, {}, 0.5));
if (foundAt)
suggs = [{__proto__:s,
text: '@' + s.text,
html: '@' + s.html,
summary: '@' + s.summary,
score: Math.pow(s.score,0.8)}
for each (s in suggs)];
return suggs;
},
logins: function nt_twuser_logins(reload) {
// TODO: figure out how often to clear this list cache.
if (this._list && !reload) return this._list;
var list = [];
var token = (Cc["@mozilla.org/security/pk11tokendb;1"]
.getService(Ci.nsIPK11TokenDB)
.getInternalKeyToken());
if (!token.needsLogin() || token.isLoggedIn()) {
// Look for twitter usernames stored in password manager
var usersFound = {};
var passwordManager = (Cc["@mozilla.org/login-manager;1"]
.getService(Ci.nsILoginManager));
/* @@@ Uncommenting these lines makes it not to work anymore,
after a long time I've no clue of how to continue, beside of taking a
javascript manual from the very beginning, I hope to get some help,
thx.
for each (let url in ["https://identi.ca", "http://identi.ca"])
{
for each (let login in passwordManager.findLogins({}, url, "",
"")) {
let {username} = login;
if (username in usersFound) continue;
usersFound[username] = true;
list.push(CmdUtils.makeSugg(username, null, login));
}
}*/
}
return this._list = list;
},
_list: null,
};
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---