}
}
widgetContent.html(trtd1 + "<ul class='other-posts'>" + trtd2 + "</ul>");
}
});
} else if(a[1] === "bsummary") {
$.ajax({
url: "/feeds/posts/default/-/" + a[0] + "?alt=json-in-script&max-results=4",
type: "get",
dataType: "jsonp",
success: function (e) {
var img = new Array();
var trtd2= '';
for (var i = 0; i < 4; i++) {
var entry = e.feed.entry[i];
var posttitle = entry.title.$t;
var posturl;
var post_comments;
var comment_url;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
posturl = entry.link[k].href;
break;
}
}
for (var k = 0; k < entry.link.length; k++) {
if ((entry.link[k].rel === 'replies') && (entry.link[k].type === 'text/html')) {
post_comments = entry.link[k].title;
comment_url = entry.link[k].href;
break;
}
}
if(post_comments === "0 Comments") {
post_comments = "No comments";
} else if (post_comments === "1 Comments") {
post_comments = "1 Comment";
}
postdate = entry.published.$t;
var day = postdate.split("-")[2].substring(0,2);
var m = postdate.split("-")[1];
var y = postdate.split("-")[0];
var daystr = day+ '/' + m + '/' + y;
if ("content" in entry) {
var postcontent = entry.content.$t;
}
s = postcontent;
a = s.indexOf("<img");
b = s.indexOf("src=\"", a);
c = s.indexOf("\"", b + 5);
d = s.substr(b + 5, c - b - 5);
if ((a != -1) && (b != -1) && (c != -1) && (d != "")) img[i] = d;
var post_image = img[i].replace('s1600/', 's500-c/');
if (i === 0) {
var summary = postcontent.replace(/<.+?>/g, '').substring(0, 90) + "...";
var trtd1 = '<div class="big-post clearfix"><a href="'+ posturl +'" class="post-image" style="background: url('+ post_image +') no-repeat center; background-size: cover;"><h2 class="post-title">'+ posttitle +'</h2></a><p class="post-summary">'+ summary +'</p><span class="publish-date"><i class="fa fa-clock-o icon"></i>'+ daystr +'</span><a class="comments" href="'+comment_url +'"><i class="fa fa-comment-o icon"></i>'+ post_comments +'</a></div>';
} else {
trtd2 = trtd2 + '<li class="content-item"><a href="' + posturl + '" class="post-image" style="background: url(' + post_image + ') no-repeat center; background-size: cover;"></a><a href="' + posturl + '" class="post-title"><h2 class="heading">' + posttitle + '</h2></a><span class="publish-date"><i class="fa fa-clock-o icon"></i>'+ daystr +'</span><a class="comments" href='+comment_url +'><i class="fa fa-comment-o icon"></i>'+ post_comments +'</a></li>';
}
}
widgetContent.html(trtd1 + "<ul class='other-posts'>" + trtd2 + "</ul>");
}
});
} else if(a[1] === "twocolumns") {
$.ajax({
url: "/feeds/posts/default/-/" + a[0] + "?alt=json-in-script&max-results="+ twocolumnsPostsNum +"",
type: "get",
dataType: "jsonp",
success: function (e) {
var img = new Array();
var trtd1 = '';
var trtd2 = '';
for (var i = 0; i < twocolumnsPostsNum; i++) {
var entry = e.feed.entry[i];
var posttitle = entry.title.$t;
var posturl;
var post_comments;
var comment_url;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
posturl = entry.link[k].href;
break;
}
}
for (var k = 0; k < entry.link.length; k++) {
if ((entry.link[k].rel === 'replies') && (entry.link[k].type === 'text/html')) {
post_comments = entry.link[k].title;
comment_url = entry.link[k].href;
break;
}
}
if(post_comments === "0 Comments") {
post_comments = "No comments";
} else if (post_comments === "1 Comments") {
post_comments = "1 Comment";
}
postdate = entry.published.$t;
var day = postdate.split("-")[2].substring(0,2);
var m = postdate.split("-")[1];
var y = postdate.split("-")[0];
var daystr = day+ '/' + m + '/' + y;
if ("content" in entry) {
var postcontent = entry.content.$t;
}
s = postcontent;
a = s.indexOf("<img");
b = s.indexOf("src=\"", a);
c = s.indexOf("\"", b + 5);
d = s.substr(b + 5, c - b - 5);
if ((a != -1) && (b != -1) && (c != -1) && (d != "")) img[i] = d;
var post_image = img[i].replace('s1600/', 's500-c/');
if(i===0 || i===1 || i===2) {
var trtd1 = trtd1 + '<li class="item clearfix"><a href="'+ posturl +'" class="post-image" style="background: url('+ post_image +') no-repeat center; background-size: cover;"></a><a href="'+ posturl +'" class="post-title"><h2 class="heading">'+ posttitle +'</h2></a><span class="publish-date"><i class="fa fa-clock-o icon"></i>'+ daystr +'</span><a class="comments" href="'+comment_url +'"><i class="fa fa-comment-o icon"></i>'+ post_comments +'</a></li>';
}
if(i===3 || i===4 || i===5) {
var trtd2 = trtd2 + '<li class="item clearfix"><a href="'+ posturl +'" class="post-image" style="background: url('+ post_image +') no-repeat center; background-size: cover;"></a><a href="'+ posturl +'" class="post-title"><h2 class="heading">'+ posttitle +'</h2></a><span class="publish-date"><i class="fa fa-clock-o icon"></i>'+ daystr +'</span><a class="comments" href="'+comment_url +'"><i class="fa fa-comment-o icon"></i>'+ post_comments +'</a></li>';
Back to home |
File page
Subscribe |
Register |
Login
| N