+function writeGooglePlusEvents(data, elem)
+{
+ var ghtml = "";
+ for (var i=0; i< data.items.length; i++)
+ {
+ var item = data.items[i];
+ var noteobj = item.object;
+ var attach = noteobj.attachments;
+ var notetxt = noteobj.content;
+ var noteimg = false;
+ if (attach)
+ {
+ for (var a=0; a<attach.length; a++)
+ {
+ if ( attach[a].objectType == "photo")
+ {
+ noteimg = attach[a].image.url;
+ }
+ else if (attach[a].objectType == "event")
+ {
+ notetxt = "<b>" + attach[a].displayName+"</b><br/>"+notetxt;
+ }
+ }
+ }
+ ghtml += '<div class="gpluspost">'
+ ghtml += '<img class="gplusactor" src="'+item.actor.image.url+'"/><p class="gplustimestamp">'+item.updated+'</p>';
+ ghtml += '<p class="gplustxt">'+notetxt+'</p>';
+ if (noteimg)
+ {
+ ghtml += '<p class="gplusimg"><img class="gplusimg" src="'+noteimg+'"/></p>';
+ }
+ ghtml += '</div>';
+ }
+ elem.innerHTML=ghtml;
+}
+
+
+function loadGooglePlusEvents()
+{
+ var gplusuri = "https://www.googleapis.com/plus/v1/people/113737596421797426873/activities/public?maxResults=3&key="+gplusapikey;
+ var gpluscontainer=document.getElementById("gplusevents");
+ gpluscontainer.innerHTML="Plus loading ...";
+ $.getJSON(gplusuri, function(data){
+ writeGooglePlusEvents(data, gpluscontainer);
+ });
+}
+