chrome://ubiquity/content/editor.xhtml
On Sep 3, 5:42 pm, marc <[email protected]> wrote:
> I have changed "get last email" to show all the unread messages
> present in the atom feed instead of just the first one. It makes the
> command more useful.
> Here's my code:
>
> function gmailCheckerAll(callback, service) {
> var url = "https://mail.google.com/mail/feed/atom";
> if(service == "googleapps"){
> url = "https://mail.google.com/a/" + getGmailAppsDomain() + "/feed/
> atom";
> }
> jQuery.get(url, null, function(atom) {
> var entries = jQuery("entry", atom);
> callback((entries.map(function(i, x) {
> x = jQuery(x);
> return {author: x.find("author > name").text(),
> subject: x.find("title").text(),
> summary: x.find("summary").text(),
> href: x.find("link").attr("href")};
> })));
> }, "xml");
>
> }
>
> CmdUtils.CreateCommand({
> names: ["get last emails"],
> arguments: [{role: "source",
> nountype: noun_type_email_service,
> label: "email service provier"}],
> icon: "chrome://ubiquity/skin/icons/email_open.png",
> description: ("Displays your most recent incoming email. Requires a
> " +
> '<a href="http://mail.google.com">Gmail</a>
> account.'),
> preview: function(pBlock, arguments) {
> var provider = (arguments.source && arguments.source.text) ?
> arguments.source.text : "";
> pBlock.innerHTML = _("Displays your most recent incoming
> emails...");
> // Checks if user is authenticated first
> // if not, do not ajaxGet, as this triggers authentication prompt
> if (Utils.getCookie(".mail.google.com", "GX")) {
> gmailCheckerAll(function(emails) {
> if (emails.length)
> pBlock.innerHTML = ("Last unread e-mail"+
> (emails.length > 1 ? "s" : "")+":" +
> (jQuery.map(emails, function(x, i) {
> return _("<a href=\"${href}\">
> <p><b>${author}</b> says: <b>$
> {subject}</b></p> <p>${summary}</p></a>", x);
> })).join("<br>"));
> else
> pBlock.innerHTML = _("<b>You have no new mail!</b>");
> }, provider);
> } else {
> pBlock.innerHTML = _("You are not logged in!<br />Press enter to
> log in.");
> }
> },
> execute: function(arguments) {
> var provider = (arguments.source && arguments.source.text) ?
> arguments.source.text : "";
> var me = this;
> gmailCheckerAll(function(emails) {
> if (!emails.length)
> displayMessage(_("You have no new mail."), me);
> Utils.openUrlInBrowser(emails[0].href);
> }, provider);
> }
>
> });
>
> How can I get this added to the official ubiquity command ?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---