var zbpConfig = {
    bloghost: "https://www.yangqq.com/",
    blogversion: "173430",
    ajaxurl: "https://www.yangqq.com/zb_system/cmd.php?act=ajax&src=",
    cookiepath: "/",
    lang: {
        error: {
            72: "名称不能为空或格式不正确",
            29: "邮箱格式不正确,可能过长或为空",
            46: "评论内容不能为空或过长"
        }
    },
    comment: {
        useDefaultEvents: true,
        inputs: {
            action: {
                getter: function () {
                    return $("#inpId").parent("form").attr("action");
                }
            },
            name: {
                selector: '#inpName',
                saveLocally: true,
                required: true,
                validateRule: /^[^\s ]+$/ig,
                validateFailedErrorCode: 72,
            },
            email: {
                selector: '#inpEmail',
                saveLocally: true,
                validateRule: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/ig,
                validateFailedErrorCode: 29,
            },
            homepage: {
                selector: '#inpHomePage',
                getter: function () {
                    var t = $('#inpHomePage').val();
                    return (!/^(.+)\:\/\//.test(t) && t !== "") ? 'http://' + t : t; 
                },
                saveLocally: true
            },
            postid: {
                selector: '#inpId',
                required: true
            },
            verify: {
                selector: '#inpVerify'
            },
            content: {
                selector: '#txaArticle',
                required: true,
                validateRule: /./ig,
                validateFailedErrorCode: 46,
            },
            replyid: {
                selector: '#inpRevID'
            },
            format: {
                getter: function () {return 'json';}
            }
        }
    }
};
var zbp = new ZBP(zbpConfig);
var bloghost = zbp.options.bloghost;
var cookiespath = zbp.options.cookiepath;
var ajaxurl = zbp.options.ajaxurl;
var lang_comment_name_error = zbp.options.lang.error[72];
var lang_comment_email_error = zbp.options.lang.error[29];
var lang_comment_content_error = zbp.options.lang.error[46];
$(function () {
    zbp.cookie.set("timezone", (new Date().getTimezoneOffset()/60)*(-1));
    var $cpLogin = $(".cp-login").find("a");
    var $cpVrs = $(".cp-vrs").find("a");
    var $addinfo = zbp.cookie.get("addinfo");
    if (!$addinfo){
        return ;
    }
    $addinfo = JSON.parse($addinfo);
    if ($addinfo.chkadmin){
        $(".cp-hello").html("欢迎 " + $addinfo.useralias + " (" + $addinfo.levelname  + ")");
        $cpLogin.html("后台管理");
    }
    if($addinfo.chkarticle){
        $cpVrs.html("新建文章");
        $cpVrs.attr("href", zbp.options.bloghost + "zb_system/cmd.php?act=ArticleEdt");
    }
});
$(function(){
  let inpNameVal = $(zbpConfig.comment.inputs.name.selector).val();
  if (typeof inpNameVal === "undefined") {
    return;
  }
  if (inpNameVal.trim() === "" || inpNameVal === "访客"){
    zbp.userinfo.output();
  }
});
document.writeln("");
var autoTextarea=function(elem,extra,maxHeight){extra=extra||0;var isFirefox=!!document.getBoxObjectFor||'mozInnerScreenX'in window,isOpera=!!window.opera&&!!window.opera.toString().indexOf('Opera'),addEvent=function(type,callback){elem.addEventListener?elem.addEventListener(type,callback,false):elem.attachEvent('on'+type,callback)},getStyle=elem.currentStyle?function(name){var val=elem.currentStyle[name];if(name==='height'&&val.search(/px/i)!==1){var rect=elem.getBoundingClientRect();return rect.bottom-rect.top-parseFloat(getStyle('paddingTop'))-parseFloat(getStyle('paddingBottom'))+'px'};return val}:function(name){return getComputedStyle(elem,null)[name]},minHeight=parseFloat(getStyle('height'));elem.style.resize='none';var change=function(){var scrollTop,height,padding=0,style=elem.style;if(elem._length===elem.value.length)return;elem._length=elem.value.length;if(!isFirefox&&!isOpera){padding=parseInt(getStyle('paddingTop'))+parseInt(getStyle('paddingBottom'))};scrollTop=document.body.scrollTop||document.documentElement.scrollTop;elem.style.height=minHeight+'px';if(elem.scrollHeight>minHeight){if(maxHeight&&elem.scrollHeight>maxHeight){height=maxHeight-padding;style.overflowY='auto'}else{height=elem.scrollHeight-padding;style.overflowY='hidden'};style.height=height+extra+'px';scrollTop+=parseInt(style.height)-elem.currHeight;document.body.scrollTop=scrollTop;document.documentElement.scrollTop=scrollTop;elem.currHeight=parseInt(style.height)}};addEvent('propertychange',change);addEvent('input',change);addEvent('focus',change);change()};