}

}

widgetContent.html("<ul class='items-wrapper-left'>" + trtd1 + "</ul>" + "<ul class='items-wrapper-right'>" + trtd2 + "</ul>");
}

});

} else if(a[1] === "grids") {

$.ajax({
url: "/feeds/posts/default/-/" + a[0] + "?alt=json-in-script&max-results="+ gridsPostsNum +"",
type: "get",
dataType: "jsonp",
success: function (e) {

var img = new Array();
var trtd = '';

for (var i = 0; i < gridsPostsNum; 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/');
var summary = postcontent.replace(/<.+?>/g, '').substring(0, 120) + "...";

var trtd = trtd + '<li class="grid_item"><a href="'+ posturl +'" class="grid_post-image" style="background: url('+ post_image +') no-repeat center; background-size: cover;"></a><a href="'+ posturl +'" class="grid_post-title"><h2 class="heading">'+ posttitle +'</h2></a><p class="grid_summary">'+ summary +'</p><div class="grid_post-info"><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></li>';

}

widgetContent.html("<ul class='grids_wrapper'>" + trtd + "</ul>");
}

});

} else if(a[1] === "list") {

$.ajax({
url: "/feeds/posts/default/-/" + a[0] + "?alt=json-in-script&max-results=5",
type: "get",
dataType: "jsonp",
success: function (e) {

var img = new Array();
var trtd2 = '';

for (var i = 0; i < 5; i++) {
var entry = e.feed.entry[i];
var posttitle = entry.title.$t;
var posturl;

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(i===0) {

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/');
var summary = postcontent.replace(/<.+?>/g, '').substring(0, 100) + "...";

var trtd1 = '<div class="list_big-post"><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>'+ posttitle +'</h2></a><p class="post-summary">'+ summary +'</p></div>';
} else {
var trtd2 = trtd2 + '<li class="list-item"><a href="'+ posturl +'" class="list_post-title"><h2 class="heading">'+ posttitle +'</h2></a></li>';
}

}

widgetContent.html(trtd1 + "<ul class='list_other-posts'>" + trtd2 + "</ul>");
}

});

} else if(a[1] === "threecolumns") {

$.ajax({
url: "/feeds/posts/default/-/" + a[0] + "?alt=json-in-script&max-results="+ threecolumnsPostsNum +"",
type: "get",
dataType: "jsonp",
success: function (e) {

var img = new Array();
var trtd = '';

for (var i = 0; i < threecolumnsPostsNum; i++) {
var entry = e.feed.entry[i];
var posttitle = entry.title.$t;
var posturl;

for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
posturl = entry.link[k].href;
break;
}
}

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/');

var trtd = trtd + '<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></li>';

Prev | Next
Pg.: 1 ... 29 30 31 32 33 34 35 36 37 38 39 ... 41


Back to home | File page

Subscribe | Register | Login | N