}
widgetContent.html("<ul class='items-wrapper'>" + trtd + "</ul>");
}
});
}
});
// ]]>
</script>
</b:if>
<b:if cond='data:blog.pageType != "error_page"'>
<script>
//<![CDATA[
/* Sidebar Widgets
--------------------------------------*/
$(".sidebar-wrapper .HTML").each(function () {
var widget = $(this);
var widgetContent = widget.children(".widget-content");
var widgetContentText = widgetContent.text().trim();
if(widgetContentText.charAt(0) === "[") {
var a = widgetContentText.match(/[^[\]]+(?=])/g);
widgetContent.removeClass("widget-content").addClass(a[0]);
if(a[0] === "socialcounter") {
var content = '';
var c = a.length;
for(i=1; i<c; i+=3) {
var content = content + '<li class="social_item-wrapper"><a href="'+ a[i+1] +'" class="social_item social_'+ a[i] +'"><i class="fa fa-'+ a[i] +' social_icon"></i><br/><span class="social_num">'+ a[i+2] +'</span></a></li>'
}
widgetContent.html('<ul class="social-counter">' + content + '</ul>');
} else if(a[0] === "randomposts") {
$.ajax({
url: "/feeds/posts/default?alt=json-in-script",
type: "get",
dataType: "jsonp",
success: function (e) {
var entryLength = e.feed.entry.length,
a = entryLength - sidebarRandomPostsNum,
n = Math.floor(Math.random() * (a + 1));
$.ajax({
url: "/feeds/posts/default?alt=json-in-script&end-index=" + n + "",
type: "get",
dataType: "jsonp",
success: function (e) {
var img = new Array();
var trtd = '';
for (var i = 0; i < sidebarRandomPostsNum; i++) {
var entry = e.feed.entry[n+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";
}
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[n] = d;
var tmb = img[n].replace('s1600/','s500-c/');
var trtd = trtd + '<li class="post-wrapper clearfix"><a href="'+ posturl +'" class="random_post-image" style="background: url('+ tmb +') no-repeat center;background-size: cover"></a><a href="'+ posturl +'"><h3 class="random_post-title">'+ posttitle +'</h3></a><a href="'+ comment_url +'" class="post-comments"><i class="fa fa-comment-o icon"></i>'+ post_comments +'</a></li>';
}
widgetContent.html('<ul class="random-posts">' + trtd + '</ul>');
}
});
}
});
} else if(a[0] === "recentposts") {
$.ajax({
url: "/feeds/posts/default?alt=json-in-script&max-results="+ sidebarRecentPostsNum +"",
type: "get",
dataType: "jsonp",
success: function (e) {
var img = new Array();
var trtd = '';
for (var i = 0; i < sidebarRecentPostsNum; 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="recent-post-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></li>';
}
widgetContent.html("<ul class='recent-posts-wrapper'>" + trtd + "</ul>");
}
});
} /*else if(a[0] === "recentcomments") {
$.ajax({
url: "/feeds/comments/default?alt=json-in-script",
type: "get",
dataType: "jsonp",
success: function (e) {
var trtd = '';
for (var i = 0; i < 5; i++) {
var entry = e.feed.entry[i];
var comment_content = entry.title;
var comment_author = entry.author.name.$t;
var commenturl;
for (var k = 0; k < entry.link.length; k++) {
if (entry.
Back to home |
File page
Subscribe |
Register |
Login
| N