});
} else if(sliderContent.match("random")) {
$.ajax({
url: "/feeds/posts/default?alt=json-in-script",
type: "get",
dataType: "jsonp",
success: function (e) {
var entryLength = e.feed.entry.length,
a = entryLength - 5,
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();
for (var i = 0; i < 7; i++) {
var entry = e.feed.entry[n+i];
var posttitle = entry.title.$t;
var posturl;
var category = '<a class="post-category" href="/search/label/'+e.feed.entry[i].category[0].term+'?max-results=7">'+e.feed.entry[i].category[0].term+'</a>';
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[n] = d;
var tmb = img[n].replace('s1600/','s500-c/');
if(i===0) {
var trtd1 = '<li class="top-box-item" style="background: url('+ tmb +') no-repeat center;background-size: cover">'+ category +'<a href="'+ posturl +'" class="slider-post-title"><h3 class="heading">'+ posttitle +'</h3></a></li>';
}
if(i===1) {
var trtd2 = '<li class="top-box-item" style="background: url('+ tmb +') no-repeat center;background-size: cover">'+ category +'<a href="'+ posturl +'" class="slider-post-title"><h3 class="heading">'+ posttitle +'</h3></a></li>';
}
if(i===2) {
var trtd3 = '<li class="top-box-item" style="background: url('+ tmb +') no-repeat center;background-size: cover">'+ category +'<a href="'+ posturl +'" class="slider-post-title"><h3 class="heading">'+ posttitle +'</h3></a></li>';
}
if(i===3) {
var trtd4 = '<li class="top-box-item" style="background: url('+ tmb +') no-repeat center;background-size: cover">'+ category +'<a href="'+ posturl +'" class="slider-post-title"><h3 class="heading">'+ posttitle +'</h3></a></li>';
}
if(i===4) {
var trtd5 = '<li class="bottom-box-item" style="background: url('+ tmb +') no-repeat center;background-size: cover">'+ category +'<a href="'+ posturl +'" class="slider-post-title"><h3 class="heading">'+ posttitle +'</h3></a></li>';
}
if(i===5) {
var trtd6 = '<li class="bottom-box-item" style="background: url('+ tmb +') no-repeat center;background-size: cover">'+ category +'<a href="'+ posturl +'" class="slider-post-title"><h3 class="heading">'+ posttitle +'</h3></a></li>';
}
if(i===6) {
var trtd7 = '<li class="bottom-box-item" style="background: url('+ tmb +') no-repeat center;background-size: cover">'+ category +'<a href="'+ posturl +'" class="slider-post-title"><h3 class="heading">'+ posttitle +'</h3></a></li>';
}
}
if(sliderTitle === "slider3") {
slider.html('<ul class="top-box-wrapper clearfix">' + trtd1 + trtd2 + trtd3 + trtd4 + '</ul><ul class="bottom-box-wrapper clearfix">' + trtd5 + trtd6 + trtd7 + '</ul>');
} else if (sliderTitle === "slider4") {
slider.html('<ul class="bottom-box-wrapper clearfix">' + trtd5 + trtd6 + trtd7 + '</ul>' + '<ul class="top-box-wrapper clearfix">' + trtd1 + trtd2 + trtd3 + trtd4 + '</ul>');
}
}
});
}
});
}
} /* if(sliderTitle === "slider3") */
/* Main content Widgets
--------------------------------------*/
$(".home-widgets .HTML").each(function () {
var widget = $(this);
var widgetContent = widget.children(".widget-content");
var widgetContentText = widgetContent.text().trim();
var a = widgetContentText.match(/[^[\]]+(?=])/g);
widgetContent.removeClass("widget-content").addClass(a[1]);
if(a[1] === "bleft") {
$.ajax({
url: "/feeds/posts/default/-/" + a[0] + "?alt=json-in-script&max-results=6",
type: "get",
dataType: "jsonp",
success: function (e) {
var img = new Array();
var trtd2= '';
for (var i = 0; i < 6; 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 (i === 0) {
var category = '<a class="post-category" href="/search/label/' + entry.category[0].term + '?max-results=7">'+ entry.category[0].term +'</a>'
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 trtd1 = '<div class="big-post clearfix" style="background: url(' + post_image + ') no-repeat center; background-size: cover;">'+ category +'<a href="' + posturl + '" class="post-title"><h2>' + posttitle + '</h2></a></div>';
} else {
trtd2 = trtd2 + '<li class="content-item"><a href="' + posturl + '" class="post-title"><h2>' + posttitle + '</h2></a></li>';
Back to home |
File page
Subscribe |
Register |
Login
| N