Skip to content

Instantly share code, notes, and snippets.

@johanbrook
Created May 2, 2012 08:41
Show Gist options
  • Select an option

  • Save johanbrook/2575149 to your computer and use it in GitHub Desktop.

Select an option

Save johanbrook/2575149 to your computer and use it in GitHub Desktop.
linkedin: function(json) {
var itemList = [],
template = global.linkedin_template;
$.each(json.post, function(){
var date = new Date(parseInt(this['creation-timestamp'])),
picture = (this.creator['picture-url']) ? this.creator['picture-url'] : "<url till fallback>";
var customData = {
created_at: date.toUTCString(),
time_ago: util.toRelativeDate(date),
permalink: this['site-group-post-url'],
creator: (this.creator) ? this.creator['first-name'] + " "+this.creator['last-name'] : "",
excerpt: (this.summary) ? util.excerpt(this.summary, 100) : "",
img: (this.creator) ? "<img src='"+ picture +"' alt='"+this.creator['first-name']+"' />" : ""
};
this.title = util.excerpt(this.title, 30);
customData.profile_link = (customData.creator)
? '<a target="_blank" href="'+this.creator['public-profile-url']+'">'+customData.creator+'</a>'
: "";
customData = $.extend({}, this, customData);
itemList.push(util.template(template, customData));
});
return itemList;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment