Advertisement
Guest User

DanBri

a guest
Oct 2nd, 2009
12,021
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // from http://pastebin.com/f1619269 and
  2. // http://ginx.com/-YGN7H#http://www.visophyte.org/blog/2009/07/23/thunderbird-jetpack-messagedisplay-overridemessagedisplay-fun/comment-page-1
  3. // for http://hg.mozilla.org/users/bugmail_asutherland.org/opc-jetpack/
  4.  
  5. jetpack.future.import("slideBar");
  6. jetpack.future.import("thunderbird.messageDisplay");
  7.  
  8. let tb = jetpack.thunderbird;
  9.  
  10. jetpack.slideBar.append({
  11.   persist: true,
  12.   onReady: function (slide) {
  13.     let doc = slide.contentDocument;
  14.     tb.messageDisplay.onMessageDisplay(function (aGlodaMsg) {
  15.     let tb = jetpack.thunderbird;
  16.     var apiUrl = "http://socialgraph.apis.google.com/otherme";
  17.     var email =  aGlodaMsg.from.contact.email;
  18.     var apiParams = {     pretty: 1,  q: email  };
  19.     var out = "";
  20.     jQuery.ajax({
  21.       type: "GET",     url: apiUrl,  data: apiParams,
  22.       datatype: "string",
  23.       error: function() {
  24.         alert( "<i>Error searching sgapi.</i>" ) ;
  25.       },
  26.       success: function(responseData) {
  27.         sg = JSON.parse(responseData);
  28.         var accounts = {}; // not used yet
  29.     var sg_atom = {};
  30.     var sg_foaf = {};
  31.     var sg_rss = {};;
  32.     var sg_photo = {};
  33.     var sg_url = {};
  34.     var sg_profile = {};
  35.     var sg_fn = {};
  36.    
  37.         for (var account in sg) {
  38.       out += "<a href='" + account + "'>"+account+"</a><br/>\n";
  39.       console.log(out);
  40.           px = sg[account]['attributes']['photo'];
  41.           if (typeof px != "undefined")
  42.             {
  43.                // out += "<img src='" + px + "'/>\n"
  44.             };
  45.  
  46.           profile = sg[account]['attributes']['profile'];
  47.           if (typeof profile != "undefined")
  48.             {
  49.         // out += "<a href='" + profile + "'> <b>"+profile+"</b></a> \n"
  50.             };
  51.  
  52.           // name
  53.           fn = sg[account]['attributes']['fn'];
  54.           if (typeof fn != "undefined")
  55.             {  
  56.             // out += "<em>"+fn+"\n"
  57.             };
  58.         } ;
  59.        // previewBlock.innerHTML += out;
  60.     }
  61.   });
  62.  
  63.       $(doc.body).empty();
  64.       $("<div />", doc.body)
  65.         .text(out + " XXXFrom: " + aGlodaMsg.from.contact.name)
  66.         .appendTo(doc.body);
  67.       $("<div />", doc.body)
  68.         .text("To: " + [to.contact.name for each
  69.                           (to in aGlodaMsg.to)].join(", "))
  70.         .appendTo(doc.body);
  71.     }, {slideHash: slide});
  72.   },
  73.   html:
  74.     <>
  75.       <body>
  76.       </body>
  77.     </>
  78. });
  79.  
  80.  
  81.  
Advertisement
RAW Paste Data Copied
Advertisement