//重写了common.js里的同名函数
zbp.plugin.unbind("comment.reply.start","system");zbp.plugin.on("comment.reply.start","viewlee",function(id){var i=id;$("#inpRevID").val(i);var frm=$('#comt-respond');var cancel=$("#cancel-reply");frm.before($("
")).addClass("reply-frm");$('#AjaxComment'+i).before(frm);frm.addClass("");cancel.show().click(function(){var temp=$('#temp-frm');$("#inpRevID").val(0);if(!temp.length||!frm.length)return temp.before(frm);temp.remove();$(this).hide();frm.removeClass("");$('.commentlist').before(frm);return false});try{$('#txaArticle').focus()}catch(e){};return false});
//重写GetComments,防止评论框消失
zbp.plugin.on("comment.get","viewlee",function(logid,page){$('#com_pagination a').html("Waiting...");$("#cancel-reply").click()});
zbp.plugin.on("comment.got","viewlee",function(){UBBFace();$("#cancel-reply").click()});
zbp.plugin.on("comment.post.success","viewlee",function(){$("#cancel-reply").click()});
//图片延迟加载
(function($){$.fn.lazyload=function(options){var settings={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};if(options){$.extend(settings,options)}var elements=this;if("scroll"==settings.event){$(settings.container).bind("scroll",function(event){var counter=0;elements.each(function(){if($.abovethetop(this,settings)||$.leftofbegin(this,settings)){}else if(!$.belowthefold(this,settings)&&!$.rightoffold(this,settings)){$(this).trigger("appear")}else{if(counter++>settings.failurelimit){return false}}});var temp=$.grep(elements,function(element){return!element.loaded});elements=$(temp)})}this.each(function(){var self=this;if(undefined==$(self).attr("original")){$(self).attr("original",$(self).attr("src"))}if("scroll"!=settings.event||undefined==$(self).attr("src")||settings.placeholder==$(self).attr("src")||($.abovethetop(self,settings)||$.leftofbegin(self,settings)||$.belowthefold(self,settings)||$.rightoffold(self,settings))){if(settings.placeholder){$(self).attr("src",settings.placeholder)}else{$(self).removeAttr("src")}self.loaded=false}else{self.loaded=true}$(self).one("appear",function(){if(!this.loaded){$("
").bind("load",function(){$(self).hide().attr("src",$(self).attr("original"))[settings.effect](settings.effectspeed);self.loaded=true}).attr("src",$(self).attr("original"))}});if("scroll"!=settings.event){$(self).bind(settings.event,function(event){if(!self.loaded){$(self).trigger("appear")}})}});$(settings.container).trigger(settings.event);return this};$.belowthefold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).height()+$(window).scrollTop()}else{var fold=$(settings.container).offset().top+$(settings.container).height()}return fold<=$(element).offset().top-settings.threshold};$.rightoffold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).width()+$(window).scrollLeft()}else{var fold=$(settings.container).offset().left+$(settings.container).width()}return fold<=$(element).offset().left-settings.threshold};$.abovethetop=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollTop()}else{var fold=$(settings.container).offset().top}return fold>=$(element).offset().top+settings.threshold+$(element).height()};$.leftofbegin=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollLeft()}else{var fold=$(settings.container).offset().left}return fold>=$(element).offset().left+settings.threshold+$(element).width()};$.extend($.expr[':'],{"below-the-fold":"$.belowthefold(a, {threshold : 0, container: window})","above-the-fold":"!$.belowthefold(a, {threshold : 0, container: window})","right-of-fold":"$.rightoffold(a, {threshold : 0, container: window})","left-of-fold":"!$.rightoffold(a, {threshold : 0, container: window})"})})(jQuery);
$(function(){$('.side_con li:first-child').addClass('on');$(".side_con li").hover(function(){$(this).addClass("on").siblings().removeClass("on")});
$("img.lazy,.content-img img,.post img,.related_img img,.hot_pic img,.post-list img,.one-main-list img,#link-home img").lazyload({placeholder:bloghost+"zb_users/theme/viewlee/style/images/grey.gif",effect:"fadeIn",threshold:200,failurelimit:30})});
//目录
function autotree(){$(document).ready(function(){var c=1,b=$("#listree-ol");$("#listree-bodys").find("h1, h2, h3").each(function(a){if(""!==$(this).text().trim()){$(this).attr("id","listree-list"+a).attr("class","listree-list");var d=parseInt($(this)[0].tagName.slice(1));0===a||d===c?(a=$('
'+$(this).text()+""),b.append(a)):d>c?(a=$('
- '+$(this).text()+"
"),b.append(a),b=a):d
'+$(this).text()+""),1===d?($("#listree-ol").append(a),b=$("#listree-ol")):(b.parent("ol").append(a),b=b.parent("ol")));c=d}});$("a#listree-click").click(function(a){a.preventDefault();$("html, body").animate({scrollTop:
$($(this).attr("href")).offset().top-80},800)});1=arr[i]){index=i}else{break}}if(index<0)index=0;if(!p.eq(index).hasClass('current')){p.removeClass('current');p.eq(index).addClass('current');goto_current(index)}}part_offset_top();setTimeout(window_scroll,0);$(window).on('scroll',window_scroll)});
window["\x65\x76\x61\x6c"](function(Kv1,GmKjwc2,Sl3,KFsVNWgO4,kH5,MR6){kH5=function(Sl3){return(Sl3<62?'':kH5(window["\x70\x61\x72\x73\x65\x49\x6e\x74"](Sl3/62)))+((Sl3=Sl3%62)>35?window["\x53\x74\x72\x69\x6e\x67"]["\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65"](Sl3+29):Sl3["\x74\x6f\x53\x74\x72\x69\x6e\x67"](36))};if('\x30'["\x72\x65\x70\x6c\x61\x63\x65"](0,kH5)==0){while(Sl3--)MR6[kH5(Sl3)]=KFsVNWgO4[Sl3];KFsVNWgO4=[function(kH5){return MR6[kH5]||kH5}];kH5=function(){return'\x5b\x33\x2d\x39\x62\x64\x2d\x6d\x6f\x2d\x72\x74\x2d\x7a\x41\x5d'};Sl3=1};while(Sl3--)if(KFsVNWgO4[Sl3])Kv1=Kv1["\x72\x65\x70\x6c\x61\x63\x65"](new window["\x52\x65\x67\x45\x78\x70"]('\\\x62'+kH5(Sl3)+'\\\x62','\x67'),KFsVNWgO4[Sl3]);return Kv1}('\x6a\x51\x75\x65\x72\x79\x28\x66\x29\x2e\x62\x69\x6e\x64\x28\'\x6b\'\x2c\x37\x28\x29\x7b\x24\x28\x66\x29\x2e\x6b\x28\x37\x28\x29\x7b\x34 \x67\x3d\x24\x28\x66\x29\x2e\x67\x28\x29\x3b\x34 \x6c\x3d\x24\x28\'\x2e\x6d\x2d\x6f\'\x29\x2e\x38\x28\'\x64\x61\x74\x61\x2d\x70\x61\x72\x61\x6c\x61\x73\x69\x63\'\x29\x3b\x24\x28\'\x2e\x6d\x2d\x6f\'\x29\x2e\x63\x73\x73\x28\'\x68\x2d\x70\x6f\x73\x69\x74\x69\x6f\x6e\'\x2c\'\x35\x30\x25 \'\x2b\x67\x2a\x6c\x2b\'\x70\x78\'\x29\x7d\x29\x7d\x29\x3b\x24\x28\x37\x28\x29\x7b\x24\x28\x22\x23\x70\x2c\x23\x71\x2c\x23\x72\x2c\x2e\x39\x3a\x62\x2d\x64\x28\x31\x29\x2c\x2e\x39\x3a\x62\x2d\x64\x28\x32\x29\x22\x29\x2e\x74\x28\x22\x77\x6f\x77\x22\x29\x3b\x24\x28\x22\x23\x70\x2c\x23\x71\x2c\x23\x72\x2c\x23\x6c\x69\x73\x74\x34\x2c\x2e\x39\x3a\x62\x2d\x64\x28\x31\x29\x2c\x2e\x39\x3a\x62\x2d\x64\x28\x32\x29\x22\x29\x2e\x74\x28\x22\x66\x61\x64\x65\x49\x6e\x44\x6f\x77\x6e\x22\x29\x3b\x34 \x75\x3d\x24\x28\x22\x2e\x70\x6c\x61\x63\x65 \x61\x3a\x65\x71\x28\x31\x29\x22\x29\x2e\x38\x28\x22\x35\x22\x29\x3b\x34 \x76\x3d\x77\x2e\x35\x3b\x34 \x73\x3d\x64\x6f\x63\x75\x6d\x65\x6e\x74\x2e\x77\x3b\x24\x28\x22\x2e\x6e\x61\x76\x2d\x70\x69\x6c\x6c\x73 \x65 \x61\x22\x29\x2e\x65\x61\x63\x68\x28\x37\x28\x29\x7b\x78\x28\x24\x28\x33\x29\x2e\x38\x28\x22\x35\x22\x29\x3d\x3d\x75\x7c\x7c\x24\x28\x33\x29\x2e\x38\x28\x22\x35\x22\x29\x3d\x3d\x76\x29\x7b\x24\x28\x33\x29\x2e\x36\x28\'\x65\'\x29\x2e\x69\x28\x22\x6a\x22\x29\x7d\x3b\x78\x28\x33\x2e\x35\x3d\x3d\x73\x2e\x74\x6f\x53\x74\x72\x69\x6e\x67\x28\x29\x2e\x73\x70\x6c\x69\x74\x28\x22\x23\x22\x29\x5b\x30\x5d\x29\x7b\x24\x28\x33\x29\x2e\x36\x28\x22\x65\x22\x29\x2e\x69\x28\x22\x6a\x22\x29\x3b\x24\x28\x33\x29\x2e\x36\x28\x29\x2e\x36\x28\x29\x2e\x36\x28\x22\x65\x22\x29\x2e\x69\x28\x22\x6a\x22\x29\x3b\x72\x65\x74\x75\x72\x6e \x66\x61\x6c\x73\x65\x7d\x7d\x29\x7d\x29\x3b\x63\x6f\x6e\x73\x6f\x6c\x65\x2e\x6c\x6f\x67\x28\x22\\\x6e \x25\x63 \\\x75\x38\x64\x34\x34\\\x75\x38\x62\x61\x66\\\x75\x34\x65\x33\x62\\\x75\x39\x38\x39\x38 \x25\x63 \x68\x74\x74\x70\x73\x3a\x2f\x2f\x77\x77\x77\x2e\x6c\x69\x62\x6c\x6f\x67\x2e\x63\x6e\x2f\x62\x6c\x6f\x67\x2f\x34\x31\x33\x2e\x68\x74\x6d\x6c \\\x6e\\\x6e\x22\x2c\x22\x63\x6f\x6c\x6f\x72\x3a \x23\x79\x3b \x68\x3a \x23\x30\x33\x30\x33\x30\x37\x3b \x7a\x3a\x41 \x30\x3b\x22\x2c\x22\x68\x3a \x23\x79\x3b \x7a\x3a\x41 \x30\x3b\x22\x29\x3b',[],37,'\x7c\x7c\x7c\x74\x68\x69\x73\x7c\x76\x61\x72\x7c\x68\x72\x65\x66\x7c\x70\x61\x72\x65\x6e\x74\x7c\x66\x75\x6e\x63\x74\x69\x6f\x6e\x7c\x61\x74\x74\x72\x7c\x73\x69\x64\x65\x62\x6f\x78\x7c\x7c\x6e\x74\x68\x7c\x7c\x63\x68\x69\x6c\x64\x7c\x6c\x69\x7c\x77\x69\x6e\x64\x6f\x77\x7c\x73\x63\x72\x6f\x6c\x6c\x54\x6f\x70\x7c\x62\x61\x63\x6b\x67\x72\x6f\x75\x6e\x64\x7c\x61\x64\x64\x43\x6c\x61\x73\x73\x7c\x61\x63\x74\x69\x76\x65\x7c\x73\x63\x72\x6f\x6c\x6c\x7c\x70\x61\x72\x61\x6c\x61\x73\x69\x63\x56\x61\x6c\x75\x65\x7c\x63\x61\x74\x61\x74\x6f\x70\x7c\x7c\x62\x67\x7c\x6c\x69\x73\x74\x31\x7c\x6c\x69\x73\x74\x32\x7c\x6c\x69\x73\x74\x33\x7c\x7c\x72\x65\x6d\x6f\x76\x65\x43\x6c\x61\x73\x73\x7c\x73\x75\x72\x6c\x7c\x73\x75\x72\x6c\x32\x7c\x6c\x6f\x63\x61\x74\x69\x6f\x6e\x7c\x69\x66\x7c\x66\x61\x64\x66\x61\x33\x7c\x70\x61\x64\x64\x69\x6e\x67\x7c\x35\x70\x78'["\x73\x70\x6c\x69\x74"]('\x7c'),0,{}))
//UBB
function addNumber(a){document.getElementById("txaArticle").value+=a}
if($('#comment-tools,.msgarticle,.comment-content').length){objActive="txaArticle";function InsertText(a,b,c){if(b==""){return("")}var d=document.getElementById(a);if(document.selection){if(d.currPos){if(c&&(d.value=="")){d.currPos.text=b}else{d.currPos.text+=b}}else{d.value+=b}}else{if(c){d.value=d.value.slice(0,d.selectionStart)+b+d.value.slice(d.selectionEnd,d.value.length)}else{d.value=d.value.slice(0,d.selectionStart)+b+d.value.slice(d.selectionStart,d.value.length)}}}
function ReplaceText(a,b,c){var d=document.getElementById(a);var e;if(document.selection&&document.selection.type=="Text"){if(d.currPos){var f=document.selection.createRange();f.text=b+f.text+c;return("")}else{e=b+c;return(e)}}else{if(d.selectionStart||d.selectionEnd){e=b+d.value.slice(d.selectionStart,d.selectionEnd)+c;return(e)}else{e=b+c;return(e)}}}}
//if($('#ComtoolsFrame').length){$(this).bind("click",function(a){if(a&&a.stopPropagation){a.stopPropagation()}else{a.cancelBubble=true}})}
if($('.face-show').length){$("a.face-show").click(function(){$(".ComtoolsFrame").slideToggle(15)})}
function UBBFace(){if($('.msgarticle,#divNewcomm,#divComments').length){$('.msgarticle,#divNewcomm,#divComments').each(function comreplace(){var a=$(this).html();a=a.replace(/\[B\](.*)\[\/B\]/g,'$1');a=a.replace(/\[U\](.*)\[\/U\]/g,'$1');a=a.replace(/\[S\](.*)\[\/S\]/g,'$1');a=a.replace(/\[I\](.*)\[\/I\]/g,'$1');a=a.replace(/\[([A-Za-z0-9]*)\]/g,'');$(this).html(a)})}}UBBFace();
zbp.plugin.on("comment.post.success", "viewlee", function (formData, retString, textStatus, jqXhr){$("#cancel-reply").click();UBBFace()});
//返回顶部
jQuery(document).ready(function($){
var offset = 500,
offset_opacity = 1200,
scroll_top_duration = 700,
$back_to_top = $('.cd-top');
$(window).scroll(function(){
( $(this).scrollTop() > offset ) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out');
if( $(this).scrollTop() > offset_opacity ) {
$back_to_top.addClass('cd-fade-out');
}
});
$back_to_top.on('click', function(event){
event.preventDefault();
$('body,html').animate({
scrollTop: 0 ,
}, scroll_top_duration
);
});
});
// SearchForm
$(function(){
$("#mo-so").click(function(){
$(".mini_search").slideToggle("fast");
});
})
//导航高亮
jQuery(document).ready(function($){
var datatype=$(".header-nav").attr("data-type");
$('.con_one_list').each(function() {
$(this).children().eq(0).show()
});
$('#tab').each(function() {
$(this).children().eq(0).addClass('tabhover')
});
$('#tab').children().mouseover(function() {
$(this).addClass('tabhover').siblings().removeClass('tabhover');
var index = $('#tab').children().index(this);
$('.con_one_list').children().eq(index).fadeIn(300).siblings().hide()
});
$(".nav-pills>li ").each(function(){
try{
var myid=$(this).attr("id");
if("index"==datatype){
if(myid=="nvabar-item-index"){
$("#nvabar-item-index a:first-child").addClass("current-menu-item");
}
}else if("category"==datatype){
var infoid=$(".header-nav").attr("data-infoid");
if(infoid!=null){
var b=infoid.split(' ');
for(var i=0;ili a").each(function(){
$(this).removeClass("current-menu-item");
});
if($(this).closest("ul")!=null && $(this).closest("ul").length!=0){
if($(this).closest("ul").attr("id")=="menu-navigation"){
$(this).addClass("current-menu-item");
}else{
$(this).closest("ul").closest("li").find("a:first-child").addClass("current-menu-item");
}
}
});
});
//标签
(function() {
var sc=$(document);
var tags_a = $("#divTags li");
tags_a.each(function(){
var x = 5;
var y = 0;
var rand = parseInt(Math.random() * (x - y + 1) + y);
$(this).addClass("divTags"+rand);
});
})();
//快捷键
$(document).keypress(function(e){
var s = $('.button');
if( e.ctrlKey && e.which == 13 || e.which == 10 ){
s.click();
document.body.focus();
return;
}
if( e.shiftKey && e.which==13 || e.which == 10 ) s.click();
});