I have changed this command a little bit
changes:
1. at first it shows in wich label you are and the count of new mails
2. you can look in labels like: all, chat, trash, spam and your own
labels
3. now the from email-address is also shown
Source:
//----------------------------------------------------------------------
// Gmail
//----------------------------------------------------------------------
CmdUtils.CreateCommand({
name: "gmail",
icon: "
https://mail.google.com/mail/images/favicon.ico",
takes: {"in label" : noun_arb_text},
execute: function() {
Utils.openUrlInBrowser( "
https://www.google.com/accounts/
ServiceLogin?service=mail");
},
preview: function( pblock, directObj) {
var lab = directObj.text;
var url = "
https://mail.google.com/mail/feed/atom/" + lab;
jQuery.get( url, {}, function(feedXml){
var entries = jQuery("entry", feedXml);
var tag = jQuery("feed", feedXml);
var label = "";
var text = label;
tag.each(function() {
var tag = jQuery(this);
var tagline = tag.find("tagline").text();
var count = tag.find("fullcount").text();
label += count + " " + tagline + "<br/><br/>";
});
if( entries.length > 0 ) {
var maxEntries = 3;
text = "";
entries.each(function(i) {
if( i < maxEntries ) {
var entry = jQuery(this);
var link = entry.find("link").attr("href");
var title = entry.find("title").text();
var author = entry.find("author name").text();
var email = entry.find("author email").text();
var summary = entry.find("summary").text();
text += "<a href='" + link + "'><b>" + title + "</b></
a><br/>";
text += "From: " + "<b>" + author + "</b>" + " '" + "<a
href='mailto:" + email + "'>" + email + "'</a><br/>";
text += summary + "<br/><br/>";
}
});
}
pblock.innerHTML = label + text ;
});
}
});