// from http://pastebin.com/f1619269 and
// http://ginx.com/-YGN7H#http://www.visophyte.org/blog/2009/07/23/thunderbird-jetpack-messagedisplay-overridemessagedisplay-fun/comment-page-1
// for http://hg.mozilla.org/users/bugmail_asutherland.org/opc-jetpack/
jetpack.future.import("slideBar");
jetpack.future.import("thunderbird.messageDisplay");
let tb = jetpack.thunderbird;
jetpack.slideBar.append({
persist: true,
onReady: function (slide) {
let doc = slide.contentDocument;
tb.messageDisplay.onMessageDisplay(function (aGlodaMsg) {
let tb = jetpack.thunderbird;
var apiUrl = "http://socialgraph.apis.google.com/otherme";
var email = aGlodaMsg.from.contact.email;
var apiParams = { pretty: 1, q: email };
var out = "";
jQuery.ajax({
type: "GET", url: apiUrl, data: apiParams,
datatype: "string",
error: function() {
alert( "<i>Error searching sgapi.</i>" ) ;
},
success: function(responseData) {
sg = JSON.parse(responseData);
var accounts = {}; // not used yet
var sg_atom = {};
var sg_foaf = {};
var sg_rss = {};;
var sg_photo = {};
var sg_url = {};
var sg_profile = {};
var sg_fn = {};
for (var account in sg) {
out += "<a href='" + account + "'>"+account+"</a><br/>\n";
console.log(out);
px = sg[account]['attributes']['photo'];
if (typeof px != "undefined")
{
// out += "<img src='" + px + "'/>\n"
};
profile = sg[account]['attributes']['profile'];
if (typeof profile != "undefined")
{
// out += "<a href='" + profile + "'> <b>"+profile+"</b></a> \n"
};
// name
fn = sg[account]['attributes']['fn'];
if (typeof fn != "undefined")
{
// out += "<em>"+fn+"\n"
};
} ;
// previewBlock.innerHTML += out;
}
});
$(doc.body).empty();
$("<div />", doc.body)
.text(out + " XXXFrom: " + aGlodaMsg.from.contact.name)
.appendTo(doc.body);
$("<div />", doc.body)
.text("To: " + [to.contact.name for each
(to in aGlodaMsg.to)].join(", "))
.appendTo(doc.body);
}, {slideHash: slide});
},
html:
<>
<body>
</body>
</>
});