function resizeText(e) {
c = document.getElementById("entry");
if (c.style.fontSize === "") {
c.style.fontSize = "1.0em"
}
c.style.fontSize = parseFloat(c.style.fontSize) + e * .1 + "em"
}
var $sup = jQuery.noConflict();
$sup(function () {
var e = function () {
this.navLi = $sup("#nav li").children("ul").hide().end();
this.init()
};
e.prototype = {
init: function () {
this.setMenu()
},
setMenu: function () {
$sup.each(this.navLi, function () {
if ($sup(this).children("ul")[0]) {
$sup(this).append("<span />").children("span").addClass("hasChildren")
}
});
this.navLi.hover(function () {
$sup(this).find("> ul").stop(true, true).slideDown("slow", "easeOutBounce")
}, function () {
$sup(this).find("> ul").stop(true, true).hide()
})
}
};
var t = function () {
this.navLi = $sup("#top_nav li").children("ul").hide().end();
this.init()
};
t.prototype = {
init: function () {
this.setMenu()
},
setMenu: function () {
$sup.each(this.navLi, function () {
if ($sup(this).children("ul")[0]) {
$sup(this).append("<span />").children("span").addClass("hasChildren")
}
});
this.navLi.hover(function () {
$sup(this).find("> ul").stop(true, true).slideDown("slow", "easeOutBounce")
}, function () {
$sup(this).find("> ul").stop(true, true).hide()
})
}
};
$sup(document).ready(function () {
new e;
new t
});
//If user slects sub category
$sup(document).ready(function () {
var hasChildren = $sup('.catnav li').find('ul');
var liunderUl = hasChildren.find('li');
if(hasChildren){
hasChildren.remove();
};
$sup('.catnav ul').append(liunderUl);
var e = $sup("#footer").find(".credits").length;
if (e == 0) {
alert("Error")
}
$sup("#backtotop").hide();
$sup("#footer_wrapper #footer #lower_footer #footer_left_part .credits, #footer_wrapper #footer #lower_footer #footer_left_part .credits a").attr("style", "display: block !important; opacity: 1!Important; visibility:visible!Important;");
$sup(function () {
$sup(window).scroll(function () {
if ($sup(this).scrollTop() > 50) {
$sup("#backtotop").fadeIn()
} else {
$sup("#backtotop").fadeOut()
}
});
$sup("#backtotop").click(function () {
$sup("body,html").animate({
scrollTop: 0
}, 600);
return false
})
});
$sup(".top_search_icon").click(function () {
$sup(".top_search .supernova_search").stop(true, true).slideToggle()
});
$sup(".top_search .supernova_search").blur(function () {
$sup(".top_search .supernova_search").delay(1800).slideUp()
});
$sup(".first_cat").hover(function () {
$sup(".top_search .supernova_search").hide()
})
});
$sup(window).scroll(function () {
if ($sup(this).scrollTop() > 10) {
$sup("#top_most").css({
"padding-top": "5px"
});
$sup(".header_catnav .header_cat_title").css({
"padding-bottom": "6px"
});
$sup(".top_search_icon").fadeIn()
} else {
$sup("#top_most").css({
"padding-top": "10px"
});
$sup(".header_catnav .header_cat_title").css({
"padding-bottom": "12px"
});
$sup(".top_search_icon").fadeOut();
$sup(".top_search #supernova_search").fadeOut()
}
});
$sup(document).ready(function (e) {
if ($sup(".credits").hasClass("responsive")) {
var t = window.innerHeight + "px";
if (window.innerWidth < 980) {
$sup("#top_most, #nav_wrapper").css({
height: t,
overflow: "auto"
})
} else {
$sup("#top_most, #nav_wrapper").css({
overflow: "visible",
height: "auto"
})
}
$sup(".media_left").click(function () {
$sup("#header_navigation").animate({
width: "toggle"
})
});
$sup(".media_left_close").click(function () {
$sup("#header_navigation").animate({
width: "toggle"
})
});
$sup(".media_right").click(function () {
$sup("#nav_wrapper").animate({
width: "toggle"
})
});
$sup(".media_right_close").click(function () {
$sup("#nav_wrapper").animate({
width: "toggle"
})
})
}
});
$sup(window).bind("resize", function (e) {
if ($sup(".credits").hasClass("responsive")) {
if (window.innerWidth < 920) {
var t = window.innerHeight + "px";
$sup("#top_most, #nav_wrapper").css({
overflow: "auto"
});
$sup("#top_most, #nav_wrapper").css({
height: t
});
$sup("#title_wrapper").css({
"margin-top": "40px"
})
} else {
$sup("#top_most, #nav_wrapper").css({
overflow: "visible"
});
$sup("#top_most, #nav_wrapper").css({
height: "auto"
});
$sup("#title_wrapper").css({
"margin-top": "10px"
})
}
}
});
/*
* Handles home ajax
*/
$sup(document).ready(function () {
$sup('#tabs div').click(function(){
var title = $sup(this).text();
$sup('.main_content').find('.latest_blogs').html(title);
$sup('#tabs div').removeClass('tab_current');
$sup(this).addClass('tab_current');
});
/************************/
/*Recent Posts*/
/************************/
$sup("#tab_one").click(function () {
$sup(".main_loop, .pagination_wrapper").fadeIn("slow"); //Will be used on next click
$sup("#popular_posts, #rec_posts").fadeOut("slow") //Hide other divs
});
var count = 1;
var paged = false;
$sup('.supernova_load_more_main').click(function(){
showmore_text = $sup(this).text(); //Show more Text
free_data = $sup(this).attr('free-data'); //Sorry no more posts available text
free_data = free_data.split('|');
loading_text = free_data[0]+'...'; //Loading... Text
sorry_nomore_text = free_data[1]; //Sorry no more posts available, please check back later text
no_more_text = free_data[2]; //No more posts available
class_data = $sup(this).attr('class');
pages = class_data.split(' ');
total_pages = pages[1];
posts_per_page = pages[3];
Pagination = $sup('.pagination_wrapper');
total_posts = (total_pages*posts_per_page - posts_per_page*count)-posts_per_page;
Pagination.find('.main_loader').show();
Pagination.find('.button').attr('title', total_posts +' More');
Pagination.find('.button').html(loading_text).prop("disabled", true);
if(total_pages > count){
supernova_loadmore_main(count, showmore_text);
count ++;
}else{
Pagination.find('.main_loader').hide();
Pagination.find('.button').attr('title', sorry_nomore_text);
Pagination.find('.button').html(no_more_text).delay(1000).fadeOut();
return false;
}
});
function supernova_loadmore_main(paged, htmlvalue){
$sup.ajax({
url: supernova_ajax_object.ajaxurl,
type:'POST',
dataType: "html",
data: "action=supernova_load_main_posts&paged="+ paged,
success: function(html){
$sup(".main_loop").append(html).hide().fadeIn();
$sup('.pagination_wrapper').find('.main_loader').hide();
$sup('.pagination_wrapper').find('.button').html(showmore_text).prop("disabled", false);
}
});
}
/************************/
/*Poplular posts*/
/************************/
var count_two = 0; //so when the user returns to this tab it doesn't load the content again
jQuery('#tab_two').click(function(){
if(count_two === 0){
jQuery('.main_loop, .pagination_wrapper, #rec_posts').fadeOut('slow');
jQuery('#popular_posts').fadeIn('slow');
title = jQuery(this).text();
jQuery('.latest_blogs').html(title).hide().fadeIn('slow');
jQuery('.supernova_ajax_loader').fadeIn('slow');
}else{
jQuery('.main_loop, .pagination_wrapper, #rec_posts').fadeOut('slow');
jQuery('#popular_posts').fadeIn('slow');
}
jQuery.ajax({
type: "POST",
dataType: "html",
url: supernova_ajax_object.ajaxurl,
data: 'action=supernova_get_popular_posts',
success: function (msg) {
if(count_two === 0){
jQuery("#popular_posts").append(msg);
count_two ++;
}
jQuery('.supernova_ajax_loader').fadeOut();
}
});
});
var popular_count = 1;
$sup('.popular_load_more').live('click', function(){
showmore_text = $sup(this).text(); //Show more Text
free_data = $sup(this).attr('free-data'); //Sorry no more posts available text
free_data = free_data.split('|');
loading_text = free_data[0]+'...'; //Loading... Text
sorry_nomore_text = free_data[1]; //Sorry no more posts available, please check back later text
no_more_text = free_data[2]; //No more posts available
total_posts = $sup(this).attr('class');
pages = total_posts.split(' ');
total_posts = pages[1];
posts_per_page = pages[3];
total_slot = Math.floor(total_posts/posts_per_page);
$sup(this).html(loading_text).delay(800).fadeOut('slow');
if(total_slot > popular_count){
supernova_popular_loadmore(popular_count);
popular_count ++;
}else{
$sup(this).attr('title', sorry_nomore_text );
$sup(this).html(no_more_text).prop("disabled", true).delay(800).fadeOut('slow');
return false;
}
});
function supernova_popular_loadmore(offset){
$sup.ajax({
url: supernova_ajax_object.ajaxurl,
type:'POST',
dataType: "html",
data: "action=supernova_get_popular_posts&offset="+ offset,
success: function(msg){
$sup("#popular_posts").append(msg).hide().fadeIn();
}
});
}
/************************/
/*Recommended Posts/*
/************************/
var count_three = 0;
$sup("#tab_three").click(function () {
if (count_three === 0) {
$sup(".main_loop, .pagination_wrapper, #popular_posts").fadeOut("slow");
$sup("#rec_posts").fadeIn("slow");
$sup(".supernova_ajax_loader").fadeIn("slow")
} else {
$sup(".main_loop, .pagination_wrapper, #popular_posts").fadeOut("slow");
$sup("#rec_posts").fadeIn("slow")
}
$sup.ajax({
type: "POST",
dataType: "html",
url: supernova_ajax_object.ajaxurl,
data: "action=supernova_get_recommended_posts",
success: function (msg) {
if (count_three === 0) {
$sup("#rec_posts").append(msg);
count_three++
}
$sup(".supernova_ajax_loader").fadeOut()
},
error: function (count_three, t, n) {
console.log("Error Message: " + t);
console.log("HTTP Error: " + n)
}
})
})
var rec_count = 1;
$sup('.rec_load_more').live('click', function(){
showmore_text = $sup(this).text(); //Show more Text
free_data = $sup(this).attr('free-data'); //Sorry no more posts available text
free_data = free_data.split('|');
loading_text = free_data[0]+'...'; //Loading... Text
sorry_nomore_text = free_data[1]; //Sorry no more posts available, please check back later text
no_more_text = free_data[2]; //No more posts available
class_data = $sup(this).attr('class');
pages = class_data.split(' ');
total_posts = pages[1];
posts_per_page = pages[3];
var total_pages = Math.ceil(total_posts/posts_per_page);
console.log(total_pages);
$sup(this).html(loading_text).prop("disabled", true);
$sup(this).delay(1000).fadeOut('slow');
if(total_pages > rec_count){
$sup(this).html(loading_text).prop("disabled", false);
supernova_rec_loadmore(rec_count, showmore_text);
rec_count ++;
}else{
$sup(this).attr('title', sorry_nomore_text );
$sup(this).html(no_more_text).prop("disabled", true).delay(800).fadeOut('slow');
return false;
}
});
function supernova_rec_loadmore(offset, showmore_text ){
$sup.ajax({
url: supernova_ajax_object.ajaxurl,
type:'POST',
dataType: "html",
data: "action=supernova_get_recommended_posts&offset="+ offset,
success: function(msg){
$sup("#rec_posts").append(msg).hide().fadeIn();
$sup(this).html(showmore_text).prop("disabled", false);
$sup('.rec_loader').hide();
}
});
}
});//Document ready Ends
}); //sup function Ends