/*! handsome 2020-08-15 */
var handsome_ajax={init:function(){this.login_ajax(),this.initAndPjax_Complete()},pjax_complete:function(){this.initAndPjax_Complete()},initAndPjax_Complete:function(){this.password_post_ajax()},login_ajax:function(){function a(){$("#login-submit").attr("disabled",!1).fadeTo("",1)}$("#Login_form").submit(function(){if($(this).hasClass("banLogin"))return location.reload(),!1;$("#login-submit").attr("disabled",!0).fadeTo("slow",.5);var b=$("#navbar-login-user").val(),c=$("#navbar-login-password").val();return""==b?($.message({title:LocalConst.LOGIN_TITLE,message:LocalConst.LOGIN_USERNAME_INFO,type:"warning"}),$("#navbar-login-user").focus(),a(),!1):""==c?($.message({title:LocalConst.LOGIN_TITLE,message:LocalConst.LOGIN_PASSWORD_INFO,type:"warning"}),$("#navbar-login-password").focus(),a(),!1):($("#login-submit").addClass("active"),$("#spin-login").addClass("show inline"),$.ajax({url:$(this).attr("action"),type:$(this).attr("method"),data:$(this).serializeArray(),error:function(){return $.message({title:LocalConst.LOGIN_TITLE,message:LocalConst.LOGIN_SUBMIT_ERROR,type:"error"}),a(),!1},success:function(b){b=$.parseHTML(b),$("#login-submit").removeClass("active"),$("#spin-login").removeClass("show inline");try{if($("#Logged-in",b).length<=0)return $.message({title:LocalConst.LOGIN_TITLE,message:LocalConst.LOGIN_SUBMIT_INFO,type:"error"}),a(),!1;b=$("#easyLogin",b).html(),$("#easyLogin").html(b),$.message({title:LocalConst.LOGIN_TITLE,message:LocalConst.LOGIN_SUBMIT_SUCCESS+' '+LocalConst.CLICK_TO_REFRESH+"",type:"success"})}catch(a){alert("按下F12,查看输出错误信息")}}}),!1)})},password_post_ajax:function(){$("#post-content").delegate("form.protected","submit",function(){return $.ajax({url:$(this).attr("action"),type:$(this).attr("method"),data:$(this).serializeArray(),error:function(a){try{if($("#post-content",data).length<=0)return $.message({title:"提交通知",message:LocalConst.SUBMIT_PASSWORD_INFO,type:"warning"}),!1;window.location.reload()}catch(a){window.location.reload(),console.log(a)}},success:function(a){try{if($("#post-content",a).length<=0)return $.message({title:"提交通知",message:LocalConst.SUBMIT_PASSWORD_INFO,type:"warning"}),!1;window.location.reload()}catch(a){console.log(a),window.location.reload()}}}),!1})}};const handsome_basics={init:function(){this.nav_handle(),this.searchTips(),this.initAndPjax_Complete()},pjax_complete:function(){this.initAndPjax_Complete()},initAndPjax_Complete:function(){},nav_handle:function(){var a=navigator.userAgent;a.indexOf("Safari")>-1&&a.indexOf("Chrome")<1&&$("#left_footer").addClass("hide"),$(document).on("click","[ui-toggle-class]",function(a){a.preventDefault();var b=$(a.target);b.attr("ui-toggle-class")||(b=b.closest("[ui-toggle-class]"));var c=b.attr("ui-toggle-class").split(","),d=b.attr("target")&&b.attr("target").split(",")||Array(b),e=0;$.each(c,function(a,b){var f=d[d.length&&e];$(f).toggleClass(c[a]),e++}),b.toggleClass("active")}),$(document).on("click","[data-toggle-class]",function(a){a.preventDefault();var b=$(this),c=b.data("toggle-class"),d={};$.each(c.split(","),function(){var a=$.trim(this);if(a){var b=a.split("="),c=b[0],e=b[1];d[c]=e}}),$.each(d,function(a,b){$(a).toggleClass(b)})});var b;$(document).on("click","[ui-nav] a .parent_name",function(a){var b=document.createElement("a");b.setAttribute("href",$(this).parent("a").attr("href")),document.body.appendChild(b),b.click()}),$(document).on("click","[ui-nav] a,[ui-nav-fold] a",function(a){b&&b.trigger("mouseleave.nav");var c=$(this);if(c.parent().siblings(".active").toggleClass("active"),c.next().is("ul")&&c.parent().toggleClass("active")&&a.preventDefault(),$(".app-aside-fix").length>0&&$(window).width()>768){var d,c=$(a.target),e=$(window).height();c.is("a")&&c.next().is(".child-nav")&&(b=c.parent().parent()),$(".app-aside-folded").length&&b&&(d=b.position().top,d+b.height()>=e&&b.css("bottom","50px"),d+150>e&&b.css("bottom",e-d-50).css("top","auto")),$(".app-aside-dock").length&&$(window).width()>991&&(console.log("重新计算:click"),console.log("height:"+b.height()+"w_h:"+e+"end:"+(e-115)),120+b.height()>=e?(console.log("height:"+b.height()+"w_h:"+e+"end:"+(e-115)),b.height(e-120)):(console.log("height:"+b.height()+"w_h:"+e+"end:"+(e-115)),b.css("height","auto")))}c.next().is("ul")||$(window).width()<768&&$(".off-screen").removeClass("show off-screen")});var c=!0;$(document).on("mouseenter","[ui-nav] a",function(a){if($(document).on("mouseenter",".app-aside>ul.nav",function(a){c=!0}),$(document).on("mouseleave",".app-aside>ul.nav",function(a){c=!1}),b&&b.trigger("mouseleave.nav"),$("> .nav",$(".app-aside")).remove(),$(".app-aside-fix").length&&!($(window).width()<768)){var d,e=$(a.target),f=$(window).height();!e.is("a")&&(e=e.closest("a")),e.next().is("ul")&&(b=e.next(),$(".app-aside-folded").length&&(e.parent().addClass("active"),b.appendTo(".app-aside"),d=e.parent().position().top,b.css("top",d),b.attr("ui-nav-fold",""),d+b.height()>f&&b.css("bottom","50px"),d+150>f&&b.css("bottom",f-d-50).css("top","auto"),b.on("mouseleave.nav",function(a){c||(b.appendTo(e.parent()),b.off("mouseleave.nav").css("top","auto").css("bottom","auto"),e.parent().removeClass("active"),c=!1)}),$(".smart").length&&$('
([\s\S]*)<\/div>/,/Typecho_Widget_Exception:(.*?) in/].some(function(b,c,d){var e=b.exec(a);if(null!=e)return l=e[1].trim(),!0}),""===l&&(l=LocalConst.COMMENT_CONTENT_LEGAL_INFO),$.message({title:LocalConst.COMMENT_TITLE,message:l,type:"warning"}),$(i).removeClass("active"),$("#spin").removeClass("show inline"),d("#error"),!1}if(j=$(".comment-list",a).html().match(/id=\"?comment-\d+/g).join().match(/\d+/g).sort(function(a,b){return a-b}).pop(),$(".page-navigator .prev").length&&""==k)j="";else if($(".comment-list").length>0){const m=$(".comment-list").html().match(/id=\"?comment-\d+/g).join().match(/\d+/g).sort(function(a,b){return a-b}).pop();if(m===j)return j="",$.message({title:LocalConst.COMMENT_TITLE,message:LocalConst.COMMENT_CONTENT_CHECK_INFO,type:"warning"}),TypechoComment.cancelReply(),$(h).val(""),d("#error"),!1}d("#success"),k?(a=$("#comment-"+j,a).hide(),$("#"+k).find(".comment-children").length<=0&&($(".time-machine").length>0?$("#"+k+" .time-machine .panel-footer").append(""):$("#"+k).append("")),j&&$("#"+k+" .comment-children .comment-list").prepend(a),k=""):(a=$("#comment-"+j,a).hide(),$(".time-machine").length>0?$(".comment-list").prepend(a):($(".comment-list").length||$("#comments").prepend(''),$(".comment-list").prepend(a))),$("#comment-"+j).fadeIn();var n;$(f).length&&(n=parseInt($(f).text().match(/\d+/)),$(f).html($(f).html().replace(n,n+1))),TypechoComment.cancelReply(),$(h).val(""),$(g+" a, #cancel-comment-reply-link").unbind("click"),c(),$(i).attr("disabled",!1).fadeTo("slow",1),j?e.animate({scrollTop:$("#comment-"+j).offset().top-LocalConst.OFF_SCROLL_HEIGHT},500):e.animate({scrollTop:$("#comments").offset().top-LocalConst.OFF_SCROLL_HEIGHT},500),$(".time-machine").length>0&&b(),feather&&feather.replace(),handsome_content.md_parse_after("comments")}catch(a){window.location.reload()}}}),!1)})},noAjaxComment:function(){$("#submit").bind("click",function(){var a=$("#author").val(),b=$("#mail").val();return""===$("#comment").val()?($.message({title:LocalConst.COMMENT_TITLE,message:LocalConst.COMMENT_CONTENT_INFO,type:"warning"}),$("#comment").focus(),!1):""===a?($.message({title:LocalConst.COMMENT_TITLE,message:LocalConst.COMMENT_NAME_INFO,type:"warning"}),$("#author").focus(),!1):""===b&&"1"===LocalConst.COMMENT_NEED_EMAIL?($.message({title:LocalConst.COMMENT_TITLE,message:LocalConst.COMMENT_EMAIL_INFO,type:"warning"}),$("#mail").focus(),!1):($(this).addClass("active"),$("#spin").addClass("show inline"),void $("#comment_form").submit())})},secretComment:function(){$("#secret_comment_checkbox").change(function(){$(this).is(":checked")?($("#comment").addClass("secret_comment_textarea"),$(this).attr("placeholder","")):$("#comment").removeClass("secret_comment_textarea")})},watchInputInComment:function(){$('input[name = "mail"]').blur(function(){var a=$(this).val();return""!=a&&$.ajax({type:"GET",data:{action:"ajax_avatar_get",form:LocalConst.BLOG_URL,email:a},success:function(a){$(".author-avatar").attr("src",a)}}),!1})}},handsome_enhance={init:function(){this.statisticPane(),this.skPlayer(),this.initAndPjax_Complete()},pjax_complete:function(){this.initAndPjax_Complete(),"water_fall"===LocalConst.THUMB_STYLE&&this.initWaterFall()},initAndPjax_Complete:function(){this.mobile_right(),this.feather(),this.plusFont(),this.showShareImg(),this.bindInsertMediumButton(),this.bindShowDiv()},feather:function(){feather.replace({width:"16px",height:"16px"})},statisticPane:function(){$("#statistic_pane").on("click",function(){"true"!==$("#statistic_pane").attr("data-status")&&(Number(window.innerWidth)<767&&$("#statistic_pane ~ .dropdown-menu .info-icons").addClass("hide"),handsome_util.addScript("https://cdn.jsdelivr.net/npm/vditor@3.2.9/dist/js/echarts/echarts.min.js","echarts_js",function(){$.getJSON("?action=get_statistic&size="+window.innerWidth,function(a){handsome_enhance.showTheEChart(a),$("#statistic_pane").attr("data-status","true")}).fail(function(){handsome_util.adminAlert("请求失败,可能原因;1. 未在Handsome插件构建搜索索引 2. 伪静态设置错误")})}))})},mobile_right:function(){$(".off-screen-toggle").click(function(){$("#aside").toggleClass("off-screen")})},showTheEChart:function(a){$(".loading-echart").addClass("hide"),$(".top-echart").removeClass("hide");const b=echarts.init(document.getElementById("post-calendar"),handsome_UI.mode),c=echarts.init(document.getElementById("posts-chart"),handsome_UI.mode),d=echarts.init(document.getElementById("categories-chart"),handsome_UI.mode),e=echarts.init(document.getElementById("tags-chart"),handsome_UI.mode),f=echarts.init(document.getElementById("category-radar"),handsome_UI.mode);var g,h,i,j;"light"===handsome_UI.mode?(g=["#ebedf0","#c6e48b","#7bc96f","#239a3b","#196127"],h="#fff",i="#3C4858",j="#f9f9f9"):(g=["#ebedf0","#c6e48b","#7bc96f","#239a3b","#196127"],h="#000",i="#fff",j="#212121");const k={backgroundColor:j,tooltip:{padding:10,backgroundColor:"#555",borderColor:"#777",borderWidth:1,formatter:function(a){var b=a.value;return'
'+b[0]+":"+b[1]+"
"}},visualMap:{show:!1,showLabel:!0,min:0,max:a.post_calendar.max,calculable:!1,inRange:{symbol:"rect",color:g},itemWidth:12,itemHeight:12,orient:"horizontal",left:"center",top:0},calendar:[{top:50,left:"center",range:a.post_calendar.range,cellSize:[13,13],splitLine:{show:!1},name:{textStyle:{color:i}},itemStyle:{borderColor:h,borderWidth:2},yearLabel:{show:!1},monthLabel:{nameMap:"cn",fontSize:11,color:i},dayLabel:{formatter:"{start} 1st",nameMap:"cn",fontSize:11,color:i}}],series:[{type:"heatmap",coordinateSystem:"calendar",calendarIndex:0,data:a.post_calendar.series}]},l={backgroundColor:j,tooltip:{},radar:{top:0,name:{textStyle:{color:i}},indicator:a.category_radar.indicator,center:["50%","55%"],radius:"66%"},series:[{type:"radar",color:["#3ecf8e"],itemStyle:{normal:{areaStyle:{type:"default"}}},data:[{value:a.category_radar.series,name:"文章分类数量"}]}]},m={backgroundColor:j,tooltip:{trigger:"axis"},xAxis:{type:"category",data:a.post_chart.xAxis},yAxis:{type:"value"},series:[{name:"文章篇数",type:"line",color:["#6772e5"],data:a.post_chart.series,markPoint:{symbolSize:45,color:["#fa755a","#3ecf8e","#82d3f4"],data:[{type:"max",itemStyle:{color:["#3ecf8e"]},name:"最大值"},{type:"min",itemStyle:{color:["#fa755a"]},name:"最小值"}]},markLine:{itemStyle:{color:["#ab47bc"]},data:[{type:"average",name:"平均值"}]}}]},n={backgroundColor:j,tooltip:{trigger:"item",formatter:"{a}
{b} : {c} ({d}%)"},pie:{top:0},series:[{name:"分类",type:"pie",radius:"50%",color:a.categories_chart.color,data:a.categories_chart.indicator,itemStyle:{emphasis:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]},o={backgroundColor:j,tooltip:{},xAxis:[{type:"category",data:a.tags_chart.indicator}],yAxis:[{type:"value"}],series:[{type:"bar",color:["#82d3f4"],barWidth:18,data:a.tags_chart.series,markPoint:{symbolSize:45,data:[{type:"max",itemStyle:{color:["#3ecf8e"]},name:"最大值"},{type:"min",itemStyle:{color:["#fa755a"]},name:"最小值"}]},markLine:{itemStyle:{color:["#ab47bc"]},data:[{type:"average",name:"平均值"}]}}]};b.setOption(k),c.setOption(m),d.setOption(n),e.setOption(o),f.setOption(l)},skPlayer:function(){$(".skPlayer-list-switch").bind("click",function(){player.toggleList()})},reInitAPlayer:function(){$(".aplayer").length<=0||loadMeting()},plusFont:function(){$(".plus-font-size").click(function(){var a=$("#post-content").css("font-size"),b=parseFloat(a,10);a.slice(-2);b<=14?b+=2:b-=2,$("#post-content").css("font-size",b+"px")})},showShareImg:function(){$("#generateShareImg").click(function(){$.message({title:LocalConst.OPERATION_NOTICE,message:LocalConst.SCREENSHOT_BEGIN,type:"info",autoClose:!1}),html2canvas(document.getElementById("mdx-share-img"),{allowTaint:!0,useCORS:!0,scale:3,onrendered:function(a){try{var b=new Image;b.setAttribute("crossOrigin","Anonymous");var c=a.toDataURL("image/png");b.src=c,$.message({title:LocalConst.OPERATION_NOTICE,message:LocalConst.SCREENSHORT_SUCCESS,type:"success"}),$.fancybox.open([{src:c,opts:{caption:LocalConst.SCREENSHOT_NOTICE,thumb:c}}],{loop:!1})}catch(a){$.message({title:LocalConst.OPERATION_NOTICE,message:LocalConst.SCREENSHORT_ERROR,type:"error"})}}})})},bindInsertMediumButton:function(){var a=document.getElementById("comment");$("#imageInsertOk").bind("click",function(){var b=$("input[ name='imageInsertModal']").val();b='
',handsome_enhance.insertContentInText(a,b,"#imageInsertModal")}),$("#videoInsertOk").bind("click",function(){var b=$("input[ name='videoInsertModal']").val();b='[vplayer url="'+b+'" /]\n',handsome_enhance.insertContentInText(a,b,"#videoInsertModal")}),$("#musicInsertOk").bind("click",function(){var b=$("input[ name='musicInsertModal']").val();$.ajax({type:"POST",url:LocalConst.BASE_SCRIPT_URL+"libs/interface/Get.php",data:{data:b,size:"small"},async:!1,success:function(c){b=c,handsome_enhance.insertContentInText(a,b,"#musicInsertModal")}})})},insertContentInText:function(a,b,c){if($(c).modal("hide"),document.selection){a.focus();document.selection.createRange().text=b,a.focus()}else if(a.selectionStart||"0"==a.selectionStart){var d=a.selectionStart,e=a.selectionEnd,f=d;a.value=a.value.substring(0,d)+b+a.value.substring(e,a.value.length),f+=b.length,a.selectionStart=f,a.selectionEnd=f,a.focus()}else a.value+=b,a.focus()},bindShowDiv:function(){$(".show_hide_div").bind("click",function(){$("#author_info").toggleClass("hide")})},initWaterFall:function(){if($(".water-fall-container").length>0){var a=Macy({container:".water-fall-container",trueOrder:!1,margin:24,columns:3,breakAt:{1500:3,1100:2,940:2,520:1,400:1},useContainerForBreakpoints:!0});setTimeout(function(){console.log("recalculate"),a.recalculate()},0)}}},handsome_content={featherReplace:!1,postSingleParse:!1,allSingleParseFlag:!1,init:function(){this.initAndPjax_Complete()},pjax_complete:function(){this.featherReplace=!1,this.postSingleParse=!1,this.allSingleParseFlag=!1,window.removeEventListener("scroll",handsome_content.tocScrollEvent),this.initAndPjax_Complete()},initAndPjax_Complete:function(){window.speechSynthesis&&window.speechSynthesis.cancel(),setTimeout(function(){handsome_content.vditorInit()},0)},vditorInit:function(){handsome_content.parseContainer("md_handsome_origin","md_handsome","handsome_md_text"),handsome_content.readMode(),handsome_content.parseContainer("comments","","")},readMode:function(){if($("#morphing").length>0)try{$("[data-morphing]").fancyMorph({hash:"morphing"}),LocalConst.AUTO_READ_MODE&&$("#morphing").click()}catch(a){}},parseContainer:function(a,b,c){""!==b&&this.vditorParse(b,c),handsome_content.originParse(a)},highlight:function(a){if(LocalConst.THEME_HIGHLIGHT_CODE){var b=""===LocalConst.CODE_STYLE_LIGHT?"github":LocalConst.CODE_STYLE_LIGHT;"dark"===handsome_UI.mode&&(b=""===LocalConst.CODE_STYLE_DARK?"dracula":LocalConst.CODE_STYLE_DARK),!0===a?handsome_util.addOrReplaceStyle(LocalConst.VDITOR_CDN+"/dist/js/highlight.js/styles/"+b+".css","highlight_css"+b):(handsome_util.addStyle(LocalConst.VDITOR_CDN+"/dist/js/highlight.js/styles/"+b+".css","highlight_css_"+b),handsome_util.addStyle(LocalConst.VDITOR_CDN+"/dist/js/highlight.js/styles/"+b+".css","highlight__test_css_"+b)),handsome_util.addScript(LocalConst.VDITOR_CDN+"/dist/js/highlight.js/highlight.pack.js","highlight_js_",function(){$("pre code").each(function(a,b){$(this).addClass("hljs"),hljs.highlightBlock(b)})})}},allSingleParse:function(a){this.allSingleParseFlag||(this.allSingleParseFlag=!0,handsome_content.highlight(),LocalConst.THEME_MATHJAX&&"vditor"!==LocalConst.EDITOR_CHOICE&&handsome_util.addScript(LocalConst.MATHJAX_SVG_CDN,"mathjax_js",function(){MathJax.typeset()}))},originParse:function(a){$("#"+a).length>0&&"true"!==$("#"+a).attr("click_status")&&($("#"+a).attr("click_status","true"),handsome_content.md_parse_after(a),handsome_content.allSingleParse(a))},vditorParse:function(a,b){if($("#"+b).length>0&&"true"!==$("#"+b).attr("click_status")){$("#"+b).attr("click_status","true");var c=$("#"+b).text(),d=""===LocalConst.CODE_STYLE_LIGHT?"github":LocalConst.CODE_STYLE_LIGHT;"dark"===handsome_UI.mode&&(d=""===LocalConst.CODE_STYLE_DARK?"dracula":LocalConst.CODE_STYLE_DARK),Vditor.preview(document.getElementById(a),c,{theme:{current:null},speech:{enable:LocalConst.POST_SPEECH},hljs:{enable:LocalConst.THEME_HIGHLIGHT_CODE,lineNumber:!0,style:d},markdown:{sanitize:!1},anchor:0,math:{engine:"MathJax",macros:{bf:"{\\boldsymbol f}",bu:"{\\boldsymbol u}",bv:"{\\boldsymbol v}",bw:"{\\boldsymbol w}"},inlineDigit:!0},after:function(){b!==a&&$("#"+b).hide(),$("#"+a+" pre code").each(function(a,b){$(this).addClass("hljs")}),handsome_content.md_loading(a),handsome_content.md_parse_after(a)}})}},post_speech:function(a){if($(".speech-button").length>0){const b=new SpeechSynthesisUtterance($("#"+a).text());void 0!==speechSynthesis.onvoiceschanged&&(speechSynthesis.onvoiceschanged=handsome_content.getVoice());const c=handsome_content.getVoice();c?(b.voice=c,b.onend=function(){$(".speech-button").removeClass("speech-current"),speechSynthesis.cancel(),$(".speech-button").html(feather.icons["play-circle"].toSvg({width:"16px",height:"16px"}))},$(".speech-button").on("click",function(){$(this).hasClass("speech-current")?$(this).hasClass("paused")?(speechSynthesis.resume(),feather.icons.circle.toSvg(),$(".speech-button").html(feather.icons["pause-circle"].toSvg({width:"16px",height:"16px"})),$(this).removeClass("paused")):(speechSynthesis.pause(),$(".speech-button").html(feather.icons["play-circle"].toSvg({width:"16px",height:"16px"})),$(this).addClass("paused")):(speechSynthesis.speak(b),$(this).addClass("speech-current"),$(".speech-button").html(feather.icons["pause-circle"].toSvg({width:"16px",height:"16px"})))})):$(".speech-button").hide()}},getVoice:function(){const a="zh_CN",b=speechSynthesis.getVoices();var c,d;return b.forEach(function(b){b.lang===a.replace("_","-")&&b.localService&&(c=b),b.default&&(d=b)}),c||(c=d),c},urlOpen:function(a){a="comments"===a?".comment-content-true":"#"+a,$(a+" a:not(.light-link):not(.no-external-link)").each(function(){const a=$(this).attr("href");a&&(-1!==a.indexOf(LocalConst.BLOG_URL_N)||-1===a.indexOf("http")||($(this).attr("target","_blank"),$(this).append('
'),$(this).prop("outerHTML",'
'+$(this).prop("outerHTML")+"")))})},md_parse_after:function(a){handsome_content.reInitAPlayer(a),handsome_content.reInitDPlayer(a),handsome_content.table_wrap(a),handsome_content.setWechatAndio(a),handsome_content.setVideoTag(a),!this.featherReplace&&$("#md_handsome").length>0&&-1!==a.indexOf("md_handsome")&&(feather.replace(),this.featherReplace=!0),handsome_content.urlOpen(a),handsome_content.seFancyBox(a),this.postSingleParse||-1===a.indexOf("md_handsome")||(this.postSingleParse=!0,window.speechSynthesis?handsome_content.post_speech(a):$(".speech-button").hide(),$("#support_author").on("click",function(){$(".pay-img").each(function(){$(this).attr("src",$(this).attr("data-original"))})}),$("#morphing").on("click",function(){$(this).attr("click_status","true"),handsome_content.parseContainer("morphing-content-real_origin","morphing-content-real","morphing-content-real_text")}),LocalConst.THEME_TOC&&handsome_content.toc(a))},md_loading:function(a){$(".loading-post").addClass("hide"),$("#"+a).removeClass("hide")},table_wrap:function(a){$("#"+a).find("table").wrap("
")},setVideoTag:function(a){$("#"+a+" video").each(function(){$(this).hasClass("dplayer-video")||(void 0!==$(this).attr("controls")&&$(this).removeAttr("controls"),void 0===$(this).attr("preload")&&$(this).attr("preload","preload"),$(this).wrap('
'),$(this).parent().append('
'),$(this).on("loadedmetadata",function(){$(this).height("auto"),$(this).width("auto"),$(this).height()>$(this).width()?($(this).width("auto"),$(this).height("90vh")):$(this).width("100%"),$(this).parent(".kyt-player").height($(this).height()),$(this).parent(".kyt-player").css("width",$(this).width())}),$(this).bind("click",function(){console.log("video click"),$(this).next(".play-button").is(":hidden")&&($(this).next(".play-button").css("display","block"),$(this).removeAttr("controls"),$(this).get(0).pause())}))}),$(window).resize(function(){$(".kyt-player").each(function(){$(this).css("height",$(this).find("video")[0].offsetHeight)})}),$("#"+a).delegate(".play-button","click",function(a){$(this).prev("video").css("background-image","none"),$(this).parent(".kyt-player").css("height",$(this).prev("video").height()),$(this).parent(".kyt-player").css("width",$(this).prev("video").width()),$(this).is(":visible")&&($(this).css("display","none"),$(this).parent().children("video").attr("controls","controls"),$(this).parent().children("video")[0].play())})},setWechatAndio:function(a){$(".weixinAudio").each(function(){var a=$(this),b=a.children("audio"),c=a.find(".audio_title"),d=a.find(".audio_source"),e=a.children("input[ name='url']").attr("value");""!==e?$.ajax({type:"GET",url:e,error:function(a){},success:function(a){var e=$.parseJSON(a);b.children("source").attr("src",e.url),b.load(),c.text(e.name),d.text(e.author)}}):(b.attr("src",a.children("input[ name='mp3']").attr("value")),b.init(),c.text(a.children("input[ name='title']").attr("value")),d.text(a.children("input[ name='tips']").attr("value")))});var b=$(".weixinAudio").weixinAudio();$(".weixinAudio").on("click",function(a){var c=$(this),d=c.index(".weixinAudio");$.each(b,function(a,b){a!="weixinAudio"+d&&b.pause()})})},outlineRender:function(a,b,c){var d="";"children"in a&&($(a).children().each(function(a,b){if(b=$(this)[0],handsome_util.hasClosestByHeadings(b)){const e=parseInt(b.tagName.substring(1),10),f=handsome_util.repeatify(" ",e-1);var g="";g=c&&"ir"===c.currentMode?b.textContent.substring(e+1).trim():b.textContent.trim();const h=b.id.lastIndexOf("_"),i=b.id.substring(0,-1===h?void 0:h);b.id=i+"_"+a,d+='
'+f+g+"
"}}),b.innerHTML=d,b.querySelectorAll(".vditor-outline__item").forEach(function(a){a.addEventListener("click",function(c){const d=a.getAttribute("data-id");$("html,body").animate({scrollTop:document.getElementById(d).offsetTop-parseInt(LocalConst.OFF_SCROLL_HEIGHT)},300),b.querySelectorAll(".vditor-outline__item").forEach(function(a){a.classList.remove("vditor-outline__item--current")}),a.classList.add("vditor-outline__item--current")})}))},toc:function(a){const b=window.innerWidth<=992?"tocTree":"toc";if($("#"+b).length>0){const c=document.getElementById(b);c&&(handsome_content.outlineRender(document.getElementById(a),c),""!==c.innerText.trim()?(c.style.display="block",this.initOutline(a)):$("#tag_toc_body").hide())}},parsePhotos:function(a){$(handsome_util.getChildName(a,".album_block")).shortcode({album:function(){const a=/
/g,b=/alt="(.*?)"/,c=this.options&&"photos"===this.options.type;var d,e=!1,f="";for(f+=c?"":"
";null!==(d=a.exec(this.contents));){e||(e=!0);var g=b.exec(d[5]),h=null==g?"":g[1];c?(f+=""):f+='"}return e||(f='相册无图片'),f+="
"}})},setPhotosAuto:function(a){$.each($(handsome_util.getChildName(a,".album-photos figure")),function(a,b){var c=new Image
;if("1"===LocalConst.LAZY_LOAD){const d=$(b).find("img").attr("data-src");c.src=d||$(b).find("img").attr("src")}else c.src=$(b).find("img").attr("src");c.onload=function(){var a=parseFloat(c.width),d=parseFloat(c.height);$(b).css("flex-grow",50*a/d),$(b).find("a").css("padding-top",d/a*100+"%")}})},setImageFancyBox:function(a){$.fancybox.defaults.hash=!1,$.fancybox.defaults.buttons=["zoom","download","thumbs","close"],$(handsome_util.getChildName(a,"img")).each(function(){var a=$(this);if(void 0!==a.attr("alt"))var b=a.attr("alt");else var b="";var c=a.parent("a"),d=typeof a.attr("noGallery"),e=typeof a.attr("noAlt"),f=typeof a.attr("imgBlur");if(void 0!==a.attr("max")&&a.wrap('
'),"undefined"===d&&c.size()<1){var g;g=void 0===this.getAttribute("data-original")||""===this.getAttribute("data-original")||null===this.getAttribute("data-original")?this.getAttribute("src"):this.getAttribute("data-original"),g=g.replace(/(.*?)[!|\?]\/.*/,"$1");var h=a.attr("class"),i="";void 0!==h&&-1!==h.indexOf("emotion")||((a.parent().hasClass("image-thumb")||LocalConst.SHOW_IMAGE_ALT&&"undefined"===e)&&(i='
'+b+""),a.addClass("block"));var j=a.prop("outerHTML");j+=i,"undefined"!==f?a.prop("outerHTML",'
'+j+""):a.prop("outerHTML",'
'+j+"")}})},seFancyBox:function(a){handsome_content.parsePhotos(a),handsome_content.setImageFancyBox(a),handsome_content.setPhotosAuto(a),"1"===LocalConst.LAZY_LOAD&&$(handsome_util.getChildName(a,"img")).lazyload({effect:"fadeIn",threshold:"200",vertical_only:!0})},reInitDPlayer:function(container){if(!("undefined"==typeof dPlayerOptions||"undefined"==typeof dPlayers||$(".dplayer").length<=0)){var regex=/