1) Install SublimeLinter (not sublimeLint)
jsHint
1) Install SublimeLinter jshint
2) Install node.js
3) Use this path in Preferences > Settings-User
"paths":
{
"linux":
[
],
"osx":
[
],
"windows":
[
"C:/Users/sayedta.ANIBRAIN/AppData/Roaming/npm",
"C:/Program Files/nodejs"
]
}
4) npm install -g jshint
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').text(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 = supernova_ajax_object.load_more_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 = supernova_ajax_object.load_more_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 = supernova_ajax_object.load_more_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();
}
});
}
/*
* Handles Supernova Tabber
* @since Supernova 1.4.8
*/
var tabber = $sup('.supernova_tabber_top li');
if(tabber.length){
tabber.click(function(){
var liIndex = $sup(this).index();
var TargetDiv = $sup('.supernova_tabber_contents').find('div');
TargetDiv.hide();
TargetDiv.eq(liIndex).fadeIn();
$sup('.supernova_tabber_current').removeClass('supernova_tabber_current');
$sup(this).find('span').addClass('supernova_tabber_current');
});
}
});//Document ready Ends
}); //sup function Ends
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').text(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 = supernova_ajax_object.load_more_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 = supernova_ajax_object.load_more_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 = supernova_ajax_object.load_more_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();
}
});
}
/*
* Handles Supernova Tabber
* @since Supernova 1.4.8
*/
var tabber = $sup('.supernova_tabber_top li');
if(tabber.length){
tabber.click(function(){
var liIndex = $sup(this).index();
var TargetDiv = $sup('.supernova_tabber_contents').find('div');
TargetDiv.hide();
TargetDiv.eq(liIndex).fadeIn();
$sup('.supernova_tabber_current').removeClass('supernova_tabber_current');
$sup(this).find('span').addClass('supernova_tabber_current');
});
}
});//Document ready Ends
}); //sup function Ends
var $sup = jQuery.noConflict();
$sup(document).ready(function (e) {
$sup("input[type=checkbox]").tzCheckbox({
labels: ["Enabled", "Disabled"]
});
$sup('.field_help').append('<span class="triangle"></span>');
$sup(".field_help").hide();
$sup(".field_help").append('<i>X</i>');
$sup('.help i').click(function(){
$sup('.field_help').fadeOut();
});
$sup(".Shelp").click(function () {
$sup(this).next().stop('true','true').fadeToggle()
});
$sup("#one, #two, #three, #four,#six, #five, #eight").hide();
$sup("#tab_one").click(function () {
ID = "#" + $sup(this).attr("id");
$sup(".tab_content").stop(true, true).hide();
$sup("#one").stop(true, true).fadeIn('fast');
$sup('.image_size_notice').hide();
document.cookie = "tab_one"
});
$sup("#tab_two").click(function () {
$sup(".tab_content").stop(true, true).hide();
$sup("#two").stop(true, true).fadeIn('fast');
$sup('.image_size_notice').hide();
document.cookie = "tab_two"
});
$sup("#tab_three").click(function () {
$sup(".tab_content").stop(true, true).hide();
$sup("#three").stop(true, true).fadeIn('fast');
$sup('.image_size_notice').hide();
document.cookie = "tab_three"
});
$sup("#tab_four").click(function () {
$sup(".tab_content").stop(true, true).hide();
$sup("#four").stop(true, true).fadeIn('fast');
$sup('.image_size_notice').delay('1000').fadeIn();
document.cookie = "tab_four"
});
$sup("#tab_five").click(function () {
$sup(".tab_content").stop(true, true).hide();
$sup("#five").stop(true, true).fadeIn('fast');
$sup('.image_size_notice').hide();
document.cookie = "tab_five"
});
$sup("#tab_six").click(function () {
$sup(".tab_content").stop(true, true).hide();
$sup("#six").stop(true, true).fadeIn('fast');
$sup('.image_size_notice').hide();
document.cookie = "tab_six"
});
$sup("#tab_seven").click(function () {
$sup(".tab_content").stop(true, true).hide();
$sup("#seven").stop(true, true).fadeIn('fast');
$sup('.image_size_notice').hide();
document.cookie = "tab_seven"
});
$sup("#tab_eight").click(function () {
$sup(".tab_content").stop(true, true).hide();
$sup("#eight").stop(true, true).fadeIn('fast');
$sup('.image_size_notice').hide();
document.cookie = "tab_eight"
});
var t = "";
var t = document.cookie;
t = t.split(";")[0];
if (t == "tab_one") {
$sup(".tab_content").hide();
$sup("#one").show();
$sup("#tab_one").addClass("supernova_current")
} else if (t == "tab_two") {
$sup(".tab_content").hide();
$sup("#two").show();
$sup("#tab_two").addClass("supernova_current")
} else if (t == "tab_three") {
$sup(".tab_content").hide();
$sup("#three").show();
$sup("#tab_three").addClass("supernova_current")
} else if (t == "tab_four") {
$sup(".tab_content").hide();
$sup("#four").show();
$sup('.image_size_notice').fadeIn();
$sup("#tab_four").addClass("supernova_current")
} else if (t == "tab_five") {
$sup(".tab_content").hide();
$sup("#five").show();
$sup("#tab_five").addClass("supernova_current")
} else if (t == "tab_six") {
$sup(".tab_content").hide();
$sup("#six").show();
$sup("#tab_six").addClass("supernova_current")
} else if (t == "tab_seven") {
$sup(".tab_content").hide();
$sup("#seven").show();
$sup("#tab_seven").addClass("supernova_current")
} else if (t == "tab_eight") {
$sup(".tab_content").hide();
$sup("#eight").show();
$sup("#tab_eight").addClass("supernova_current")
} else if (t == "tab_nine") {
$sup(".tab_content").hide();
$sup("#nine").show();
$sup("#tab_nine").addClass("supernova_current")
} else if (t = "") {
$sup(".tab_content").hide();
$sup("#one").show()
}
$sup(".supernova_tabs").click(function () {
$sup("#message").fadeOut();
});
$sup(".supernova_tabs").on("click", "li", function () {
$sup(".supernova_tabs .supernova_current").removeClass("supernova_current");
$sup(this).addClass("supernova_current")
});
$sup("#more_images1").hide();
$sup("#more_images2").hide();
$sup(".loader").show();
$sup(".new-button-primary, .submit").click(function () {
$sup(".loader").show();
$sup("saving_settings").show()
});
$sup(".supernova_saved").delay(400).fadeOut(500)
});
$sup(window).load(function () {
$sup(".loader").hide();
$sup("#supernova_options_page").css({
display: "block"
})
});
$sup.fn.tzCheckbox = function (e) {
e = $sup.extend({
labels: ["ON", "OFF"]
}, e);
return this.each(function () {
var t = $sup(this),
n = [];
if (t.data("on")) {
n[0] = t.data("on");
n[1] = t.data("off")
} else n = e.labels;
var r = $sup("<span>", {
"class": "tzCheckBox " + (this.checked ? "checked" : ""),
html: '<span class="tzCBContent">' + n[this.checked ? 0 : 1] + '</span><span class="tzCBPart"></span>'
});
r.insertAfter(t.hide());
r.click(function () {
r.toggleClass("checked");
var e = r.hasClass("checked");
t.attr("checked", e);
r.find(".tzCBContent").html(n[e ? 0 : 1])
});
t.bind("change", function () {
r.click()
})
})
};
$sup(document).ready(function (e) {
//Handles remove buttons
$sup('.remove-button').click(function(){
var Ptd = $sup(this).parent().parent();
Ptd.find('.supernova_links').val('');
var imgDiv = Ptd.find('.imgpre_ref');
if(imgDiv){
imgDiv.find('img').remove();
}
});
//changes slider image when a different one selected
$sup('.sup_slider_link').each(function(){
var This = $sup(this);
$sup('.sup_slider_link').hover(function(){
var Slider_link = This.find('.supernova_links');
var thumb_link = This.find('.imgpre_loaded');
link = Slider_link.val(); //the input value
if(link.length > 0 ){ //If input has link
if(thumb_link.length > 0 ){
thumb_link.attr('src', link);
}else{
This.find('.imgpre_ref').html('<img class="imgpre_loaded" src="'+link+'" />');
}
}else{ //if input doesn't have link
This.find('.imgpre_ref').html(' ');
}
});
});
//Handles Let me slected in for popular posts
$sup(".letmeselect").hide();
$sup("#letmeselect").click(function(){$sup(".letmeselect").fadeIn()});$sup(".popular_post_selection span:first-child, .oncomments").click(function(){$sup(".letmeselect").fadeOut()});
//Handles reset Button
$sup(".reset_button").click(function () {
if (confirm("Just making sure you didn't hit me by mistake, click ok to reset settings?")) {
return true;
} else {
return false;
}
});
$sup(".new-button-primary").on("click", function (e) {
ContentWidth = $sup("#content-width").val();
SidebarWidth = $sup("#sidebar-width").val();
var t = +ContentWidth + +SidebarWidth;
Diff = 100 - (+ContentWidth + +SidebarWidth);
if (t !== 100) {
$sup(".loader").hide();
alert("The total of 'Content Width' and 'Sidbar Width' should be 100%, there still a difference of " + Diff + "%. Please adjust values");
return false
} else {
return true
}
});
$sup(".supernova_links").blur(function () {
var e = $sup(this);
var t = e.val();
if (t && !t.match(/^http([s]?):\/\/.*/)) {
e.val("http://" + t)
}
});
var t;
setInterval(function () {
if (t == 0) {
$sup("#menu_right sup").removeClass("blink");
t = 1
} else {
if (t = 1) {
$sup("#menu_right sup").addClass("blink");
t = 0
}
}
}, 500)
});
$sup(document).ready(function () {
$sup('.scheme_one').each(function () {
var checkInput = $sup(this).find('input');
if (checkInput.is('[checked]')) {
checkInput.parent().find('.checkedyes').show();
}
})
$sup('.sidebar_left, .sidebar_right').click(function () {
$sup(this).find('#sidebar-pos').attr('checked', 'checked');
});
$sup('.scheme_two').click(function () {
$sup(this).find('input').attr('checked', 'checked');
});
$sup('.scheme_color').click(function () {
$sup(this).next().attr('checked', 'checked');
$sup(this).next().addClass('checkchecker');
$sup('.scheme_one').each(function () {
$sup('.scheme_one').find('.checkedyes').fadeOut();
})
if ($sup(this).next().hasClass('checkchecker')) {
$sup(this).find('.checkedyes').fadeIn();
} else {
$sup(this).find('.checkedyes').fadeOut();
}
});
$sup('tr label').click(function () {
var CheckTarget = $sup(this).parent().parent().find('.tzCheckBox');
var ContentTarget = $sup(this).parent().parent().find('.tzCBContent');
var InputTarget = $sup(this).parent().parent().find('input');
if (!CheckTarget)
return false;
if (CheckTarget.hasClass('checked')) {
CheckTarget.removeClass('checked');
ContentTarget.html('Disabled');
InputTarget.removeAttr('checked', 'checked');
} else {
CheckTarget.addClass('checked');
ContentTarget.html('Enabled');
InputTarget.attr('checked', 'checked');
}
});
$sup('.supernova_slider-from-page').click(function(){
$sup('#supernova_admin_form').submit();
})
})
$sup(document).ready(function(){var e;$sup(".supernova-upload-button").click(function(){e=$sup(this).prev("input");tb_show("","media-upload.php?TB_iframe=true");return false});window.old_tb_remove=window.tb_remove;window.tb_remove=function(){window.old_tb_remove();e=null};window.original_send_to_editor=window.send_to_editor;window.send_to_editor=function(t){if(e){fileurl=$sup("img",t).attr("src");$sup(e).val(fileurl);tb_remove()}else{window.original_send_to_editor(t)}}})
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