/*******************************************************************
**--> Intro: For Spark Customize WordPress Themes;
**--> Author: lizus.com@gmail.com
**--> WebSite: http://lizus.com
*******************************************************************/
jQuery.noConflict();
//hide empty
jQuery(document).ready(function (){
jQuery('.entry p:empty').hide();
jQuery('.entry div:empty').hide();
jQuery('#pro_hide_content p:empty').hide();
jQuery('.pro_entry p:empty').hide();
jQuery('.firstone p:empty').hide();
jQuery('.close_parent').parent().hide();
});
//set all current menu item
jQuery(document).ready(function (){
jQuery('.current-cat').each(function (){
jQuery(this).addClass('current-menu-item');
});
jQuery('.current_page_item').each(function (){
jQuery(this).addClass('current-menu-item');
});
});
//list_item
jQuery(document).ready(function (){
jQuery('.list_item:last').addClass('list_item_last');
jQuery('.list_item:odd').addClass('list_item_double');
});
//general_widget_wrap
jQuery(document).ready(function (){
jQuery('.general_widget_wrap').each(function (){
jQuery(this).children('li:odd').addClass('widget_double');
jQuery(this).children('li:last').addClass('widget_last');
})
});
//nav submenu slide
jQuery(document).ready(function (){
jQuery('.nav').each(function (){
jQuery(this).children('ul').children('li:last').addClass('last');
});
jQuery('.nav li>ul').hide();
jQuery('.nav li').hover(function (){
jQuery(this).addClass('hover');
jQuery(this).children('ul').stop().css({height:'auto',display:'none'}).slideDown('fast',function (){
jQuery(this).css({
overflow:'visible',
height:'auto'
});
});
},function (){
jQuery(this).removeClass('hover');
jQuery(this).children('ul').stop().slideUp('slow');
});
});
//list item double & last
jQuery(document).ready(function (){
jQuery('ul').each(function (){
jQuery(this).children('li:odd').addClass('double');
jQuery(this).children('li:last').addClass('last');
})
jQuery('ol').each(function (){
jQuery(this).children('li:odd').addClass('double');
jQuery(this).children('li:last').addClass('last');
})
});
//multi_widget_wrap function
jQuery(document).ready(function (){
jQuery('.multi_widget_wrap').each(function (){
if(jQuery(this).children('.widget').size()==0){
jQuery(this).hide();
return;
}
var multiH2='
';
jQuery(this).prepend(multiH2);
jQuery(this).children('.widget').hide();
jQuery(this).children('.widget').children('.widget_title').hide();
jQuery(this).children('.widget:first').show();
jQuery(this).children('.widget_title').children('span:first').addClass('current');
});
jQuery('.multi_widget_wrap .widget_title span:not(".current")').live('click',function (){
var parent=jQuery(this).parent();
var index=parent.children('span').index(jQuery(this));
parent.siblings('.widget').stop();
parent.siblings('.widget').slideUp('fast',reHeight);
parent.siblings('.widget:eq('+index+')').slideDown('fast',reHeight);
parent.children('span').removeClass('current');
jQuery(this).addClass('current');
});
jQuery('.multi_widget_wrap .widget_title span').live('mouseover',function (){
jQuery(this).addClass('hover');
});
jQuery('.multi_widget_wrap .widget_title span').live('mouseout',function (){
jQuery(this).removeClass('hover');
});
});
//add num to widget list
jQuery(document).ready(function (){
jQuery('li','.widget').each(function (){
var p=jQuery(this).parent();
var num=p.children('li').index(jQuery(this));
jQuery(this).addClass('num_'+(num+1));
});
});
//add class to widget content
jQuery(document).ready(function (){
jQuery('.widget').each(function (){
jQuery(this).children('div').add(jQuery(this).children('ul')).addClass('widget_content');
});
});
//用于tabs的shortcode产生的内容
jQuery(document).ready(function (){
jQuery('.tabs').each(function (){
var tabs=jQuery(this);
var tabH3=jQuery('.tabH3',this);
jQuery(this).prepend('');
var ul=jQuery(this).children('.tabUL:first');
tabH3.each(function (){
var index=jQuery('h3').index(jQuery(this));
jQuery(this).attr('id','tabH3_'+index);
ul.append(''+jQuery(this).text()+'');
});
jQuery('.tab',this).hide();
jQuery('.tab:first',this).addClass('show_now').show();
jQuery('a',ul).bind('click',function (){
var id=jQuery(this).attr('id');
id=id.substring(2);
var targetH3=jQuery('#'+id);
if (targetH3.parents('.tab').hasClass('show_now')) return false;
jQuery('.tab',tabs).filter('.show_now').slideUp();
jQuery('.tab',tabs).removeClass('show_now');
targetH3.parents('.tab').addClass('show_now').slideDown();
return false;
});
});
});
/*******************************************************************
**--> Intro: For Spark Customize WordPress Themes;
**--> Author: lizus.com@gmail.com
**--> WebSite: http://lizus.com
*******************************************************************/
jQuery.noConflict();
//Markup external link;
jQuery(document).ready(function(){
jQuery("a[href*='http://']:not([href*='"+location.hostname+"']),[href*='https://']:not([href*='"+location.hostname+"'])").addClass("external");//.attr("target","_blank");
});
//font
jQuery(document).ready(function (){
jQuery('#nav-primary li.current-menu-item a span').addClass('current');
var aspan=jQuery('#nav-primary li').not('.current-menu-item').children('a').children('span');
aspan.each(function (){
jQuery(this).after(jQuery(this).clone());
jQuery(this).addClass('normal');
jQuery(this).next().addClass('hover');
});
jQuery('#nav-primary a span.normal').each(function (){
var txt=jQuery(this).html();
var font='msyh.ttf';
var fontSize=13;
var txtColor='777777';
var bgColor='262525';
var rs='';
//如果文字之间不用空格;
rs=spark_font(txt,font,fontSize,txtColor,bgColor);
//输出
jQuery(this).html(rs);
});
jQuery('#nav-primary a span.hover').each(function (){
var txt=jQuery(this).html();
var font='msyh.ttf';
var fontSize=13;
var txtColor='ffffff';
var bgColor='161515';
var rs='';
//如果文字之间不用空格;
rs=spark_font(txt,font,fontSize,txtColor,bgColor);
//输出
jQuery(this).html(rs);
});
jQuery('#nav-primary a span.current').each(function (){
var txt=jQuery(this).html();
var font='msyh.ttf';
var fontSize=13;
var txtColor='473107';
var bgColor='9E7F3F';
var rs='';
//如果文字之间不用空格;
rs=spark_font(txt,font,fontSize,txtColor,bgColor);
//输出
jQuery(this).html(rs);
});
jQuery('#nav-primary a').hover(function (){
jQuery(this).children('.normal').hide();
jQuery(this).children('.hover').show();
},function (){
jQuery(this).children('.hover').hide();
jQuery(this).children('.normal').show();
});
});
/*
//繁简转换
jQuery(document).ready(function (){
var defaultEncoding = 0; //默认是否繁体,0-简体,1-繁体
var translateDelay = 0; //延迟时间,若不在