From ed01198907ab46eb3e8020c3e26d8be747ceb6ce Mon Sep 17 00:00:00 2001 From: adler <1101635162@qq.com> Date: Wed, 9 Aug 2023 11:14:42 +0800 Subject: [PATCH] :art: build min.css/js --- src/main/resources/js/article.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/js/article.min.js b/src/main/resources/js/article.min.js index b8145811..0c568e2b 100644 --- a/src/main/resources/js/article.min.js +++ b/src/main/resources/js/article.min.js @@ -1,4 +1,4 @@ var Comment={editor:void 0,report:function(e){var t=$(e);t.attr("disabled","disabled").css("opacity","0.3"),$.ajax({url:Label.servePath+"/report",type:"POST",cache:!1,data:JSON.stringify({reportDataId:$("#reportDialog").data("id"),reportDataType:$("#reportDialog").data("type"),reportType:$("input[name=report]:checked").val(),reportMemo:$("#reportTextarea").val()}),complete:function(e){t.removeAttr("disabled").css("opacity","1"),0===e.responseJSON.code?(Util.alert(Label.reportSuccLabel),$("#reportTextarea").val(""),$("#reportDialog").dialog("close")):Util.alert(e.responseJSON.msg)}})},accept:function(e,t,i){confirm(e)&&$.ajax({url:Label.servePath+"/comment/accept",type:"POST",headers:{csrfToken:Label.csrfToken},cache:!1,data:JSON.stringify({commentId:t}),success:function(e){0!==e.code?Util.alert(e.msg):($(i).closest("li").addClass("cmt-perfect"),$(i).remove())}})},remove:function(i){if(!confirm(Label.confirmRemoveLabel))return!1;$.ajax({url:Label.servePath+"/comment/"+i+"/remove",type:"POST",cache:!1,success:function(e,t){0===e.code?$("#"+i).remove():Util.alert(e.msg)}})},exchangeCmtSort:function(e){e=0===e?1:0,window.location.href=window.location.pathname+"?m="+e},_bgFade:function(e){return 0!==e.length&&($(window).scrollTop(e[0].offsetTop-48),"comments"!==e.attr("id"))&&(e.css({"background-color":"#9bbee0"}),setTimeout(function(){e.css({"background-color":"#FFF",transition:"all 3s cubic-bezier(0.56, -0.36, 0.58, 1)"})},100),void setTimeout(function(){e.removeAttr("style")},3100))},edit:function(e){Comment._toggleReply(),$(".cmt-anonymous").hide(),$.ajax({url:Label.servePath+"/comment/"+e+"/content",type:"GET",cache:!1,success:function(e,t){0===e.code&&Comment.editor.setValue(e.commentContent)}}),$("#replyUseName").html(' '+Label.commonUpdateCommentPermissionLabel+"").data("commentId",e)},goComment:function(e){if(0===$(e.substr(e.length-14,14)).length)return window.location=e,!1;$("#comments .list > ul > li").removeAttr("style"),Comment._bgFade($(e.substr(e.length-14,14)))},_setCmtVia:function(){$(".cmt-via").each(function(){var e=$(this).data("ua"),e=Util.getDeviceByUa(e);""!==e&&$(this).html("via "+e)})},_toggleReply:function(e){return Label.isLoggedIn?0===$("#commentContent").length?(Util.alert(Label.notAllowCmtLabel),!1):"false"===$(this).data("hasPermission")?(Article.permissionTip(Label.noPermissionLabel),!1):$(".footer").attr("style")?($(".editor-panel .wrapper").slideUp(function(){$(".editor-panel").fadeOut(100),$(".footer").removeAttr("style")}),!1):($(".cmt-anonymous").show(),$(".footer").css("margin-bottom",$(".editor-panel > .wrapper").outerHeight()+"px"),$("#replyUseName").html(''+$(".article-title").text().replace(//g,">")+"").removeData(),"0px"!==$(".editor-panel").css("bottom")&&($(".editor-panel .wrapper").hide(),$(".editor-panel").css("bottom",0)),$(".editor-panel").show(),void $(".editor-panel .wrapper").slideDown(function(){Comment.editor.focus(),e&&e()})):(Util.needLogin(),!1)},loadEmojis:function(){let t=Comment.getEmojis(),i="";for(let e=0;e
-`;$("#emojis").html(i)},confirmed:!1,delEmoji:function(t){if(!0===Comment.confirmed||confirm("确定要删除该表情包吗?")){Comment.confirmed=!0;var i=Comment.getEmojis();for(let e=0;e\n\n
\n
\n \n
\n',"从URL导入表情包"),$("#fromURL").focus(),$("#fromURL").unbind(),$("#fromURL").bind("keypress",function(e){"13"==e.keyCode&&(Comment.addEmoji($("#fromURL").val()),Util.closeAlert())})},addEmoji:function(){for(let e=0;e ul > li.focus").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .icon-reply").parent().click():Comment._toggleReply(),!1}).bind("keyup","h",function(){return 1===$("#comments .list > ul > li.focus").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .icon-heart").parent().click(),!1}).bind("keyup","t",function(){return 1===$("#comments .list > ul > li.focus").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .icon-thumbs-up").parent().click(),!1}).bind("keyup","d",function(){return 1===$("#comments .list > ul > li.focus").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .icon-thumbs-down").parent().click(),!1}).bind("keyup","c",function(){return 1===$("#comments .list > ul > li.focus .comment-info .icon-reply-to").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .comment-info .icon-reply-to").parent().click(),!1}).bind("keyup","m",function(){return 1===$("#comments .list > ul > li.focus .comment-action > .ft-fade > .fn-pointer").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .comment-action > .ft-fade > .fn-pointer").click(),!1}).bind("keyup","a",function(){return"x"===Util.prevKey&&1===$("#comments .list > ul > li.focus .icon-setting").parent().length&&(window.location=$("#comments .list > ul > li.focus .icon-setting").parent().attr("href")),!1}).bind("keyup","m",function(){return"v"===Util.prevKey&&Article.toggleToc(),!1}).bind("keyup","h",function(){return"v"===Util.prevKey&&$("#thankArticle").click(),!1}).bind("keyup","t",function(){return"v"===Util.prevKey&&$(".article-header .icon-thumbs-up").parent().click(),!1}).bind("keyup","d",function(){return"v"===Util.prevKey&&$(".article-header .icon-thumbs-down").parent().click(),!1}).bind("keyup","i",function(){return"v"===Util.prevKey&&$(".article-header .icon-view").parent().click(),!1}).bind("keyup","c",function(){return"v"===Util.prevKey&&$(".article-header .icon-star").parent().click(),!1}).bind("keyup","l",function(){return"v"===Util.prevKey&&$(".article-header .icon-history").parent().click(),!1}).bind("keyup","e",function(){return"v"===Util.prevKey&&1===$(".article-actions .icon-edit").parent().length&&(window.location=$(".article-actions .icon-edit").parent().attr("href")),!1}).bind("keyup","s",function(){return"v"===Util.prevKey&&1===$(".article-actions .icon-chevron-up").length&&Article.stick(Label.articleOId),!1}).bind("keyup","a",function(){return"v"===Util.prevKey&&1===$(".article-actions .icon-setting").parent().length&&(window.location=$(".article-actions .icon-setting").parent().attr("href")),!1}).bind("keyup","p",function(){return"v"===Util.prevKey&&1===$(".article-header a[rel=prev]").length&&(window.location=$(".article-header a[rel=prev]").attr("href")),!1}).bind("keyup","n",function(){return"v"===Util.prevKey&&1===$(".article-header a[rel=next]").length&&(window.location=$(".article-header a[rel=next]").attr("href")),!1})},init:function(){if($("#sendComment").click(function(){Comment._toggleReply()}),1===$(window.location.hash).length&&Comment._bgFade($(window.location.hash)),this._setCmtVia(),this._initHotKey(),$.pjax({selector:"#comments .pagination a",container:"#comments",show:"",cache:!1,storage:!0,titleSuffix:"",callback:function(){Util.parseMarkdown(),Util.parseHljs(),Util.listenUserCard()}}),NProgress.configure({showSpinner:!1}),$("#comments").bind("pjax.start",function(){NProgress.start()}),$("#comments").bind("pjax.end",function(){NProgress.done()}),!Label.isLoggedIn||!document.getElementById("commentContent"))return!1;Comment.editor=Util.newVditor({id:"commentContent",cache:!0,preview:{mode:"editor"},resize:{enable:!0,position:"top"},height:200,placeholder:Label.commentEditorPlaceholderLabel,ctrlEnter:function(){Comment.add(Label.articleOId,Label.csrfToken,document.getElementById("articleCommentBtn"))},esc:function(){$(".editor-hide").click()}})},thank:function(e,t,i,n,a){return Label.isLoggedIn?!(0===n&&!confirm(i))&&void $.ajax({url:Label.servePath+"/comment/thank",type:"POST",headers:{csrfToken:t},cache:!1,data:JSON.stringify({commentId:e}),error:function(e,t,i){Util.alert(i)},success:function(e,t){var i,n,o;0===e.code?($(a).removeAttr("onclick"),i=$(''),n=$(a).offset().top,o=$(a).offset().left,i.css({"z-index":9999,top:n,left:o,position:"absolute","font-size":16,"-moz-user-select":"none","-webkit-user-select":"none","-ms-user-select":"none"}),$("body").append(i),i.animate({left:o-150,top:n-60,opacity:0},1e3,function(){var e=parseInt($(a).text());$(a).html(' '+(e+1)).addClass("ft-red"),i.remove()})):Util.alert(e.msg)}}):(Util.needLogin(),!1)},showReply:function(e,r,t){var s=$(r).closest("li").find("."+t);if("comment-get-comment"===t){if(0!==s.find("li").length)return s.html(""),!1}else if(0===$(r).find(".icon-chevron-down").length)return $(r).find(".icon-chevron-up").removeClass("icon-chevron-up").addClass("icon-chevron-down").find("use").attr("xlink:href","#chevron-down"),s.html(""),!1;if("0.3"===$(r).css("opacity"))return!1;t="comment-get-comment"===t?"/comment/original":"/comment/replies";$.ajax({url:Label.servePath+t,type:"POST",data:JSON.stringify({commentId:e,userCommentViewMode:Label.userCommentViewMode}),beforeSend:function(){$(r).css("opacity","0.3")},success:function(e,t){if(0!==e.code)return Util.alert(e.msg),!1;var i=e.commentReplies,n="";0===(i=i instanceof Array?i:[i]).length&&(n='
  • '+Label.removedLabel+"
  • ");for(var o=0;o
    ')+(''))+('
    '))+"
    "+'
    ')+(''))+a.commentAuthorName+"")+(' • '+a.timeAgo);0 '+a.rewardedCnt+" "),n=(n+=" "+Util.getDeviceByUa(a.commentUA)+"")+('
    '+a.commentContent+"
    ")}s.html("
      "+n+"
    "),Util.parseHljs(),Util.parseMarkdown(),$(r).find(".icon-chevron-down").removeClass("icon-chevron-down").addClass("icon-chevron-up").find("use").attr("xlink:href","#chevron-up")},error:function(e){Util.alert(e.statusText)},complete:function(){$(r).css("opacity","1")}})},add:function(e,t,i){var n={articleId:e,commentAnonymous:$("#commentAnonymous").prop("checked"),commentVisible:$("#commentVisible").prop("checked"),commentContent:Comment.editor.getValue(),userCommentViewMode:Label.userCommentViewMode},e=($("#replyUseName").data("commentOriginalCommentId")&&(n.commentOriginalCommentId=$("#replyUseName").data("commentOriginalCommentId")),Label.servePath+"/comment"),o="POST",a=$("#replyUseName").data("commentId");a&&(e=Label.servePath+"/comment/"+a,o="PUT"),$.ajax({url:e,type:o,headers:{csrfToken:t},cache:!1,data:JSON.stringify(n),beforeSend:function(){$(i).attr("disabled","disabled").css("opacity","0.3")},success:function(e,t){$(i).removeAttr("disabled").css("opacity","1"),0===e.code?(a&&($("#"+a+" > .fn-flex > .fn-flex-1 > .vditor-reset").html(e.commentContent),$("#"+a+" .icon-history").parent().show()),n.commentOriginalCommentId&&Util.setUnreadNotificationCount(),Comment.editor.setValue(""),$(".editor-hide").click(),$("#replyUseName").text("").removeData(),1===Label.userCommentViewMode?Comment._bgFade($("#comments")):Comment._bgFade($("#bottomComment"))):$("#addCommentTip").addClass("error").html("
    • "+e.msg+"
    ")},error:function(e){$("#addCommentTip").addClass("error").html("
    • "+e.statusText+"
    ")},complete:function(){$(i).removeAttr("disabled").css("opacity","1"),setTimeout(Util.listenUserCard,1e3)}})},reply:function(e,t){Comment._toggleReply(function(){$(window).height()-($("#"+t)[0].offsetTop-$(window).scrollTop()+$("#"+t).outerHeight())<$(".editor-panel .wrapper").outerHeight()&&$(window).scrollTop($("#"+t)[0].offsetTop-($(window).height()-$(".editor-panel .wrapper").outerHeight()-$("#"+t).outerHeight()))});var i="",n=$("#"+t).find(">.fn-flex>div>a").clone(),i=0===n.length?((n=$("#"+t).find(">.fn-flex .avatar").clone()).removeClass("avatar").addClass("avatar-small"),' '+n[0].outerHTML+" "+e+""):(n.addClass("ft-a-title").attr("href","#"+t).attr("onclick",'Comment._bgFade($("#'+t+'"))'),n.find("div").removeClass("avatar").addClass("avatar-small").after(" "+e).before(' '),n[0].outerHTML);$("#replyUseName").html(i).data("commentOriginalCommentId",t)}},Article={initAudio:function(){$(".content-audio").each(function(){var e=$(this);new APlayer({element:this,narrow:!1,autoplay:!1,mutex:!0,theme:"#4285f4",preload:"none",mode:"circulation",music:{title:e.data("title"),author:'音乐分享',url:e.data("url"),pic:Label.staticServePath+"/images/music.png"}})});var e=$("#articleAudio");if(0===e.length)return!1;new APlayer({element:document.getElementById("articleAudio"),narrow:!1,autoplay:!1,mutex:!0,theme:"#4285f4",mode:"order",preload:"none",music:{title:"语音预览",author:'小薇',url:e.data("url"),pic:Label.staticServePath+"/images/blank.png"}})},permissionTip:function(e){Label.isLoggedIn?Util.alert(e):Util.needLogin()},voteUp:function(e,t,i){var o,a;return Label.isLoggedIn?(o=$(i),a=o.next(),!o.hasClass("disabled")&&(i={dataId:e},o.addClass("disabled"),void $.ajax({url:Label.servePath+"/vote/up/"+t,type:"POST",cache:!1,data:JSON.stringify(i),success:function(e,t){o.removeClass("disabled");var i=parseInt(o.text()),n=parseInt(a.text());0===e.code?0===e.type?o.html(' '+(i-1)).removeClass("ft-red"):(o.html(' '+(i+1)).addClass("ft-red"),a.hasClass("ft-red")&&a.html(' '+(n-1)).removeClass("ft-red")):Util.alert(e.msg)}}))):(Util.needLogin(),!1)},voteDown:function(e,t,i){var o,a;return Label.isLoggedIn?(o=$(i),a=o.prev(),!o.hasClass("disabled")&&(i={dataId:e},o.addClass("disabled"),void $.ajax({url:Label.servePath+"/vote/down/"+t,type:"POST",cache:!1,data:JSON.stringify(i),success:function(e,t){o.removeClass("disabled");var i=parseInt(a.text()),n=parseInt(o.text());if(0===e.code)return 1===e.type?o.html(' '+(n-1)).removeClass("ft-red"):(o.html(' '+(n+1)).addClass("ft-red"),a.hasClass("ft-red")&&a.html(' '+(i-1)).removeClass("ft-red")),!1;Util.alert(e.msg)}}))):(Util.needLogin(),!1)},previewImgAfterLoading:function(){$(".img-preview img").css("transform","translate3d("+Math.max(0,$(window).width()-$(".img-preview img").width())/2+"px, "+Math.max(0,$(window).height()-$(".img-preview img").height())/2+"px, 0)"),setTimeout(function(){$(".img-preview").width($(window).width())},300)},init:function(){this.initToc(),this.share(),Util.parseHljs(),Util.parseMarkdown();var t=null,e=($(".article").on("dblclick",".vditor-reset img",function(){clearTimeout(t),$(this).hasClass("emoji")||1===$(this).closest(".editor-panel").length||1===$(this).closest(".ad").length||window.open($(this).attr("src"))}).on("click",".vditor-reset img",function(e){var i,n;clearTimeout(t),$(this).hasClass("emoji")||1===$(this).closest(".editor-panel").length||1===$(this).closest(".ad").length||(i=$(this),n=this,t=setTimeout(function(){var e=n.offsetTop,t=n.offsetLeft;1===i.closest(".comments").length&&(e+=i.closest("li")[0].offsetTop,t=t+$(".comments")[0].offsetLeft+15),$("body").append('
    '),$(".img-preview").css({"background-color":"#fff",position:"fixed"})},100))}),$("#articltVia").data("ua")),e=Util.getDeviceByUa(e),e=(""!==e&&$("#articltVia").text("via "+e),$("#revision").dialog({width:500<$(window).width()?500:$(window).width()-50,height:$(window).height()-50,modal:!0,hideFooter:!0}),$("#reportDialog").dialog({width:500<$(window).width()?500:$(window).width()-50,height:450,modal:!0,hideFooter:!0}),this.initAudio(),$(window).scroll(function(){var e=$(window).scrollTop();$(".share").css("top",e+60+"px"),e<$(".article-title").offset().top?($(".article-header").css("top","-60px"),$(".nav").show()):($(".article-header").css("top","0"),$(".nav").hide())}),$(window).resize(function(){if($("#articleToC > .module-panel").height($(window).height()-48),$(window).width()<1024)return 0!==$("#articleToC").length&&$(".article-body .wrapper, #articleCommentsPanel, .article-footer").css("margin-right","auto"),!1;var e;1===$("#articleToC").length&&(e=$("#articleToC").width(),e=($(window).width()-e-$(".article-info").width()-30)/3+e,$(".article-body .wrapper, #articleCommentsPanel, .article-footer").css("margin-right",e+"px"))}),location.search.split("r=")[1]);e&&sessionStorage.setItem("r",e.split("&")[0]),$(function(){$.ajax({url:Label.servePath+"/api/article/reward/senders/"+Label.articleOId,method:"GET",async:!1,headers:{csrfToken:Label.csrfToken},success:function(e){if(0===e.code&&""!==e.data){var t=e.data;for(let e=0;e\n
    \n
    \n
    \n")}Util.listenUserCard()}}})})},revision:function(e,n){if(!Label.isLoggedIn)return Util.needLogin(),!1;n=n||"article",$.ajax({url:Label.servePath+"/"+n+"/"+e+"/revisions",cache:!1,success:function(e,t){var i;if(0===e.code)return 0===e.revisions.length||1===e.revisions.length?($("#revision > .revisions").remove(),$("#revisions").html(""+Label.noRevisionLabel+"")):($("#revisions").html("").prev().remove(),$("#revisions").data("revisions",e.revisions).before('
    '+(e.revisions.length-1)+"~"+e.revisions.length+"/"+e.revisions.length+'
    '),e.revisions.length<=2&&$("#revision a").first().addClass("disabled"),i=JsDiff.createPatch("",e.revisions[e.revisions.length-2].revisionData.articleContent||e.revisions[e.revisions.length-2].revisionData.commentContent,e.revisions[e.revisions.length-1].revisionData.articleContent||e.revisions[e.revisions.length-1].revisionData.commentContent,e.revisions[e.revisions.length-2].revisionData.articleTitle||"",e.revisions[e.revisions.length-1].revisionData.articleTitle||""),new Diff2HtmlUI({diff:i}).draw("#revisions",{matching:"lines",outputFormat:"side-by-side",synchronisedScroll:!0}),Article._revisionsControls(n)),!1;Util.alert(e.msg)}}),$("#revision").dialog("open")},_revisionsControls:function(e){var t=$("#revisions").data("revisions");$("#revision a.first").click(function(){var e;$(this).hasClass("disabled")||((e=parseInt($("#revision .revisions").text().split("~")[0]))<=2?$(this).addClass("disabled"):$(this).removeClass("disabled"),2 span").html(e-1+"~"+e+"/"+t.length),e=JsDiff.createPatch("",t[e-2].revisionData.articleContent||t[e-2].revisionData.commentContent,t[e-1].revisionData.articleContent||t[e-1].revisionData.commentContent,t[e-2].revisionData.articleTitle||"",t[e-1].revisionData.articleTitle||""),new Diff2HtmlUI({diff:e}).draw("#revisions",{matching:"lines",outputFormat:"side-by-side",synchronisedScroll:!0}))}),$("#revision a.last").click(function(){var e;$(this).hasClass("disabled")||((e=parseInt($("#revision .revisions span").text().split("~")[0]))>t.length-3?$(this).addClass("disabled"):$(this).removeClass("disabled"),2 span").html(e+1+"~"+(e+2)+"/"+t.length),e=JsDiff.createPatch("",t[e].revisionData.articleContent||t[e].revisionData.commentContent,t[e+1].revisionData.articleContent||t[e+1].revisionData.commentContent,t[e].revisionData.articleTitle||"",t[e+1].revisionData.articleTitle||""),new Diff2HtmlUI({diff:e}).draw("#revisions",{matching:"lines",outputFormat:"side-by-side",synchronisedScroll:!0}))})},share:function(){var o=$("#qrCode").data("shareurl");$("#qrCode").qrcode({width:90,height:90,text:o}),$("body").click(function(){$("#qrCode").slideUp()}),$(".share > span").click(function(){var e,t,i,n=$(this).data("type");return!!n&&("wechat"===n?($("#qrCode").slideToggle(),!1):"copy"!==n&&(e=encodeURIComponent(Label.articleTitle+" - "+Label.symphonyLabel),t=encodeURIComponent(o),i=$(".article-info .avatar-mid").css("background-image"),pic=i.substring(5,i.length-2),(i={}).tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+e+"&url="+t+"&pic="+pic,i.weibo="http://v.t.sina.com.cn/share/share.php?title="+e+"&url="+t+"&pic="+pic,i.google="https://plus.google.com/share?url="+t,i.twitter="https://twitter.com/intent/tweet?status="+e+" "+t,void window.open(i[n],"_blank","top=100,left=200,width=648,height=618")))}),$("#qrCode").click(function(){$(this).hide()}),$("#shareClipboard").mouseover(function(){$(this).attr("aria-label",Label.copyLabel)}),Util.clipboard($("#shareClipboard"),$("#shareClipboard").next(),function(){$("#shareClipboard").attr("aria-label",Label.copiedLabel)})},reward:function(e){confirm(Label.rewardConfirmLabel)&&$.ajax({url:Label.servePath+"/article/reward?articleId="+e,type:"POST",cache:!1,success:function(e,t){var i,n;0===e.code?($("#articleRewardContent .vditor-reset").html(e.articleRewardContent),Util.parseHljs(),Util.parseMarkdown(),i=$("#articleRewardContent > span"),n=parseInt(i.text()),i.addClass("ft-red").removeClass("ft-blue").html(n+1+" "+Label.rewardLabel).removeAttr("onclick")):Util.alert(e.msg)},error:function(e){Util.needLogin()}})},thankArticle:function(e,t){return Label.isLoggedIn?!(0===t&&!confirm(Label.thankArticleConfirmLabel))&&(Label.currentUserName===Label.articleAuthorName?(Util.alert(Label.thankSelfLabel),!1):void $.ajax({url:Label.servePath+"/article/thank?articleId="+e,type:"POST",cache:!1,success:function(e,t){var i,n,o;if(0===e.code)return n=parseInt($("#thankArticle").text()),$("#thankArticle").removeAttr("onclick").html(''+(n+1)+"").addClass("ft-red").removeClass("ft-blue"),i=$(''),n=$("#thankArticle").offset().top,o=$("#thankArticle").offset().left,i.css({"z-index":9999,top:n-20,left:o,position:"absolute","font-size":16,"-moz-user-select":"none","-webkit-user-select":"none","-ms-user-select":"none"}),$("body").append(i),i.animate({top:n-180,opacity:0},1500,function(){i.remove()}),!1;Util.alert(e.msg)}})):(Util.needLogin(),!1)},stick:function(e){confirm(Label.stickConfirmLabel)&&$.ajax({url:Label.servePath+"/article/stick?articleId="+e,type:"POST",cache:!1,success:function(e,t){Util.alert(e.msg),window.location.href=Label.servePath+"/recent"}})},playThought:function(e){function i(e,t){3===(e=e.split(l)).length&&e.splice(0,0,"");var i=e[0],n=e[2].split("-"),o=e[3].split("-");if(n[0]=parseInt(n[0]),n[1]=parseInt(n[1]),o[0]=parseInt(o[0]),o[1]=parseInt(o[1]),i===d){for(var a=[],r=n[1];o[1],r span"),a=$("#thoughtProgress > svg"),r="#articleThought",s=e.split(t),m=Math.max(s[s.length-2].split(l)[1]/3e4,2);""===s[s.length-1]&&s.pop();for(var u=0,f=0;u").replace(/ /g," ").replace(/ /g,"    ");$(r).data("text",e).html(t)},parseInt(s[u].split(l)[1])/m);for(var h=0,p=parseInt(s[u-1].split(l)[1])/m,v=setInterval(function(){p<=h?(o.width("100%"),a.css("left","100%"),clearInterval(v)):(h+=20,a.css("left",100*h/p+"%"),o.width(100*h/p+"%"))},20),g="",b="",w=0,C=0,y=0;C").replace(/ /g," ").replace(/ /g,"    "),g=k;$(r).html(b),w=Math.max(w,$(r).height())}$("#thoughtProgressPreview").html('
    '+b+"
    "),$("#thoughtProgressPreview").dialog({modal:!0,hideFooter:!0}),a.click(function(){$("#thoughtProgressPreview").dialog("open")}),$(r).html(b).height(w).css("margin-bottom","15px").html("")},initToc:function(){if(0===$("#articleToC").length)return $(".article-body .wrapper, #articleCommentsPanel, .article-footer").css("margin-right","auto"),!1;var e=$("#articleToC").width(),e=($(window).width()-e-$(".article-info").width()-30)/3+e,a=($(".article-body .wrapper, #articleCommentsPanel, .article-footer").css("margin-right",e+"px"),$("#articleToC > .module-panel").height($(window).height()-48),$("#articleToC")),r=$(".article-toc"),s=$(".article-content [id^=toc]"),l=!1;a.offset().top;toc=[],a.find("li").click(function(){var e=$(this);setTimeout(function(){a.find("li").removeClass("current"),e.addClass("current")},50)}),$(window).scroll(function(e){if(parseInt($("#articleToC").css("right"))<0)return!1;$("#articleToC > .module-panel").height($(window).height()-49),toc=[],s.each(function(e){toc.push({id:this.id,offsetTop:this.offsetTop})});for(var t=$(window).scrollTop(),i=0,n=toc.length;i=toc[toc.length-1].offsetTop-53&&(a.find("li").removeClass("current"),a.find("li:last").addClass("current"));var o=a.find("li.current")[0].offsetTop;l||(r.scrollTop()o-30&&r.scrollTop(o)),setTimeout(function(){l=!1},600)}),$(window).scroll(),r.scrollTop(a.find("li.current")[0].offsetTop).scroll(function(){l=!0})},toggleToc:function(){var e=$("#articleToC");if(0===e.length)return!1;var t=$(".article-header .icon-unordered-list");t.hasClass("ft-red")?(e.animate({right:"-"+$("#articleToC").outerWidth()+"px"}),t.removeClass("ft-red"),$(".article-actions .icon-unordered-list").removeClass("ft-red")):(e.animate({right:0}),t.addClass("ft-red"),$(".article-actions .icon-unordered-list").addClass("ft-red"))},makeNotificationRead:function(e,t){$.ajax({url:Label.servePath+"/notifications/make-read",type:"POST",cache:!1,data:JSON.stringify({articleId:e,commentIds:t})})}};Article.init(),$(document).ready(function(){Comment.init(),Comment.listenUploadEmojis(),Comment.loadEmojis();{let e=(new Date).getTime(),t=0;function i(){0!==t&&(clearTimeout(t),t=0),$("#emojiList").css("top","auto"),$("#emojiList").css("bottom","60px"),e=(new Date).getTime(),t=setTimeout(()=>{(new Date).getTime()-e<=700&&$("#emojiList").removeClass("showList")},null!==navigator.userAgent.match(/(phone|pad|pod|ios|Android|Mobile|BlackBerry|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian)/i)?0:600)}$("#emojiBtn").hover(function(){0!==t&&(clearTimeout(t),t=0),e=(new Date).getTime(),setTimeout(()=>0!==$("#emojiBtn:hover").length&&$("#emojiList").addClass("showList"),300)},i),$("#emojiList").hover(function(){0!==t&&(clearTimeout(t),t=0),e=(new Date).getTime()},i)}ArticleChannel.init(Label.articleChannel),Label.isLoggedIn&&(Article.makeNotificationRead(Label.articleOId,Label.notificationCmtIds),setTimeout(function(){Util.setUnreadNotificationCount()},1e3))}); \ No newline at end of file +`;$("#emojis").html(i)},confirmed:!1,delEmoji:function(t){if(!0===Comment.confirmed||confirm("确定要删除该表情包吗?")){Comment.confirmed=!0;var i=Comment.getEmojis();for(let e=0;e\n\n
    \n
    \n \n
    \n',"从URL导入表情包"),$("#fromURL").focus(),$("#fromURL").unbind(),$("#fromURL").bind("keypress",function(e){"13"==e.keyCode&&(Comment.addEmoji($("#fromURL").val()),Util.closeAlert())})},addEmoji:function(){for(let e=0;e ul > li.focus").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .icon-reply").parent().click():Comment._toggleReply(),!1}).bind("keyup","h",function(){return 1===$("#comments .list > ul > li.focus").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .icon-heart").parent().click(),!1}).bind("keyup","t",function(){return 1===$("#comments .list > ul > li.focus").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .icon-thumbs-up").parent().click(),!1}).bind("keyup","d",function(){return 1===$("#comments .list > ul > li.focus").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .icon-thumbs-down").parent().click(),!1}).bind("keyup","c",function(){return 1===$("#comments .list > ul > li.focus .comment-info .icon-reply-to").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .comment-info .icon-reply-to").parent().click(),!1}).bind("keyup","m",function(){return 1===$("#comments .list > ul > li.focus .comment-action > .ft-fade > .fn-pointer").length&&"x"===Util.prevKey&&$("#comments .list > ul > li.focus .comment-action > .ft-fade > .fn-pointer").click(),!1}).bind("keyup","a",function(){return"x"===Util.prevKey&&1===$("#comments .list > ul > li.focus .icon-setting").parent().length&&(window.location=$("#comments .list > ul > li.focus .icon-setting").parent().attr("href")),!1}).bind("keyup","m",function(){return"v"===Util.prevKey&&Article.toggleToc(),!1}).bind("keyup","h",function(){return"v"===Util.prevKey&&$("#thankArticle").click(),!1}).bind("keyup","t",function(){return"v"===Util.prevKey&&$(".article-header .icon-thumbs-up").parent().click(),!1}).bind("keyup","d",function(){return"v"===Util.prevKey&&$(".article-header .icon-thumbs-down").parent().click(),!1}).bind("keyup","i",function(){return"v"===Util.prevKey&&$(".article-header .icon-view").parent().click(),!1}).bind("keyup","c",function(){return"v"===Util.prevKey&&$(".article-header .icon-star").parent().click(),!1}).bind("keyup","l",function(){return"v"===Util.prevKey&&$(".article-header .icon-history").parent().click(),!1}).bind("keyup","e",function(){return"v"===Util.prevKey&&1===$(".article-actions .icon-edit").parent().length&&(window.location=$(".article-actions .icon-edit").parent().attr("href")),!1}).bind("keyup","s",function(){return"v"===Util.prevKey&&1===$(".article-actions .icon-chevron-up").length&&Article.stick(Label.articleOId),!1}).bind("keyup","a",function(){return"v"===Util.prevKey&&1===$(".article-actions .icon-setting").parent().length&&(window.location=$(".article-actions .icon-setting").parent().attr("href")),!1}).bind("keyup","p",function(){return"v"===Util.prevKey&&1===$(".article-header a[rel=prev]").length&&(window.location=$(".article-header a[rel=prev]").attr("href")),!1}).bind("keyup","n",function(){return"v"===Util.prevKey&&1===$(".article-header a[rel=next]").length&&(window.location=$(".article-header a[rel=next]").attr("href")),!1})},init:function(){if($("#sendComment").click(function(){Comment._toggleReply()}),1===$(window.location.hash).length&&Comment._bgFade($(window.location.hash)),this._setCmtVia(),this._initHotKey(),$.pjax({selector:"#comments .pagination a",container:"#comments",show:"",cache:!1,storage:!0,titleSuffix:"",callback:function(){Util.parseMarkdown(),Util.parseHljs(),Util.listenUserCard()}}),NProgress.configure({showSpinner:!1}),$("#comments").bind("pjax.start",function(){NProgress.start()}),$("#comments").bind("pjax.end",function(){NProgress.done()}),!Label.isLoggedIn||!document.getElementById("commentContent"))return!1;Comment.editor=Util.newVditor({id:"commentContent",cache:!0,preview:{mode:"editor"},resize:{enable:!0,position:"top"},height:200,placeholder:Label.commentEditorPlaceholderLabel,ctrlEnter:function(){Comment.add(Label.articleOId,Label.csrfToken,document.getElementById("articleCommentBtn"))},esc:function(){$(".editor-hide").click()}})},thank:function(e,t,i,n,a){return Label.isLoggedIn?!(0===n&&!confirm(i))&&void $.ajax({url:Label.servePath+"/comment/thank",type:"POST",headers:{csrfToken:t},cache:!1,data:JSON.stringify({commentId:e}),error:function(e,t,i){Util.alert(i)},success:function(e,t){var i,n,o;0===e.code?($(a).removeAttr("onclick"),i=$(''),n=$(a).offset().top,o=$(a).offset().left,i.css({"z-index":9999,top:n,left:o,position:"absolute","font-size":16,"-moz-user-select":"none","-webkit-user-select":"none","-ms-user-select":"none"}),$("body").append(i),i.animate({left:o-150,top:n-60,opacity:0},1e3,function(){var e=parseInt($(a).text());$(a).html(' '+(e+1)).addClass("ft-red"),i.remove()})):Util.alert(e.msg)}}):(Util.needLogin(),!1)},showReply:function(e,r,t){var s=$(r).closest("li").find("."+t);if("comment-get-comment"===t){if(0!==s.find("li").length)return s.html(""),!1}else if(0===$(r).find(".icon-chevron-down").length)return $(r).find(".icon-chevron-up").removeClass("icon-chevron-up").addClass("icon-chevron-down").find("use").attr("xlink:href","#chevron-down"),s.html(""),!1;if("0.3"===$(r).css("opacity"))return!1;t="comment-get-comment"===t?"/comment/original":"/comment/replies";$.ajax({url:Label.servePath+t,type:"POST",data:JSON.stringify({commentId:e,userCommentViewMode:Label.userCommentViewMode}),beforeSend:function(){$(r).css("opacity","0.3")},success:function(e,t){if(0!==e.code)return Util.alert(e.msg),!1;var i=e.commentReplies,n="";0===(i=i instanceof Array?i:[i]).length&&(n='
  • '+Label.removedLabel+"
  • ");for(var o=0;o
    ')+(''))+('
    '))+"
    "+'
    ')+(''))+a.commentAuthorName+"")+(' • '+a.timeAgo);0 '+a.rewardedCnt+" "),n=(n+=" "+Util.getDeviceByUa(a.commentUA)+"")+('
    '+a.commentContent+"
    ")}s.html("
      "+n+"
    "),Util.parseHljs(),Util.parseMarkdown(),$(r).find(".icon-chevron-down").removeClass("icon-chevron-down").addClass("icon-chevron-up").find("use").attr("xlink:href","#chevron-up")},error:function(e){Util.alert(e.statusText)},complete:function(){$(r).css("opacity","1")}})},add:function(e,t,i){var n={articleId:e,commentAnonymous:$("#commentAnonymous").prop("checked"),commentVisible:$("#commentVisible").prop("checked"),commentContent:Comment.editor.getValue(),userCommentViewMode:Label.userCommentViewMode},e=($("#replyUseName").data("commentOriginalCommentId")&&(n.commentOriginalCommentId=$("#replyUseName").data("commentOriginalCommentId")),Label.servePath+"/comment"),o="POST",a=$("#replyUseName").data("commentId");a&&(e=Label.servePath+"/comment/"+a,o="PUT"),$.ajax({url:e,type:o,headers:{csrfToken:t},cache:!1,data:JSON.stringify(n),beforeSend:function(){$(i).attr("disabled","disabled").css("opacity","0.3")},success:function(e,t){$(i).removeAttr("disabled").css("opacity","1"),0===e.code?(a&&($("#"+a+" > .fn-flex > .fn-flex-1 > .vditor-reset").html(e.commentContent),$("#"+a+" .icon-history").parent().show()),n.commentOriginalCommentId&&Util.setUnreadNotificationCount(),Comment.editor.setValue(""),$(".editor-hide").click(),$("#replyUseName").text("").removeData(),1===Label.userCommentViewMode?Comment._bgFade($("#comments")):Comment._bgFade($("#bottomComment"))):$("#addCommentTip").addClass("error").html("
    • "+e.msg+"
    ")},error:function(e){$("#addCommentTip").addClass("error").html("
    • "+e.statusText+"
    ")},complete:function(){$(i).removeAttr("disabled").css("opacity","1"),setTimeout(Util.listenUserCard,1e3)}})},reply:function(e,t){Comment._toggleReply(function(){$(window).height()-($("#"+t)[0].offsetTop-$(window).scrollTop()+$("#"+t).outerHeight())<$(".editor-panel .wrapper").outerHeight()&&$(window).scrollTop($("#"+t)[0].offsetTop-($(window).height()-$(".editor-panel .wrapper").outerHeight()-$("#"+t).outerHeight()))});var i="",n=$("#"+t).find(">.fn-flex>div>a").clone(),i=0===n.length?((n=$("#"+t).find(">.fn-flex .avatar").clone()).removeClass("avatar").addClass("avatar-small"),' '+n[0].outerHTML+" "+e+""):(n.addClass("ft-a-title").attr("href","#"+t).attr("onclick",'Comment._bgFade($("#'+t+'"))'),n.find("div").removeClass("avatar").addClass("avatar-small").after(" "+e).before(' '),n[0].outerHTML);$("#replyUseName").html(i).data("commentOriginalCommentId",t)}},Article={initAudio:function(){$(".content-audio").each(function(){var e=$(this);new APlayer({element:this,narrow:!1,autoplay:!1,mutex:!0,theme:"#4285f4",preload:"none",mode:"circulation",music:{title:e.data("title"),author:'音乐分享',url:e.data("url"),pic:Label.staticServePath+"/images/music.png"}})});var e=$("#articleAudio");if(0===e.length)return!1;new APlayer({element:document.getElementById("articleAudio"),narrow:!1,autoplay:!1,mutex:!0,theme:"#4285f4",mode:"order",preload:"none",music:{title:"语音预览",author:'小薇',url:e.data("url"),pic:Label.staticServePath+"/images/blank.png"}})},permissionTip:function(e){Label.isLoggedIn?Util.alert(e):Util.needLogin()},voteUp:function(e,t,i){var o,a;return Label.isLoggedIn?(o=$(i),a=o.next(),!o.hasClass("disabled")&&(i={dataId:e},o.addClass("disabled"),void $.ajax({url:Label.servePath+"/vote/up/"+t,type:"POST",cache:!1,data:JSON.stringify(i),success:function(e,t){o.removeClass("disabled");var i=parseInt(o.text()),n=parseInt(a.text());0===e.code?0===e.type?o.html(' '+(i-1)).removeClass("ft-red"):(o.html(' '+(i+1)).addClass("ft-red"),a.hasClass("ft-red")&&a.html(' '+(n-1)).removeClass("ft-red")):Util.alert(e.msg)}}))):(Util.needLogin(),!1)},voteDown:function(e,t,i){var o,a;return Label.isLoggedIn?(o=$(i),a=o.prev(),!o.hasClass("disabled")&&(i={dataId:e},o.addClass("disabled"),void $.ajax({url:Label.servePath+"/vote/down/"+t,type:"POST",cache:!1,data:JSON.stringify(i),success:function(e,t){o.removeClass("disabled");var i=parseInt(a.text()),n=parseInt(o.text());if(0===e.code)return 1===e.type?o.html(' '+(n-1)).removeClass("ft-red"):(o.html(' '+(n+1)).addClass("ft-red"),a.hasClass("ft-red")&&a.html(' '+(i-1)).removeClass("ft-red")),!1;Util.alert(e.msg)}}))):(Util.needLogin(),!1)},previewImgAfterLoading:function(){$(".img-preview img").css("transform","translate3d("+Math.max(0,$(window).width()-$(".img-preview img").width())/2+"px, "+Math.max(0,$(window).height()-$(".img-preview img").height())/2+"px, 0)"),setTimeout(function(){$(".img-preview").width($(window).width())},300)},init:function(){this.initToc(),this.share(),Util.parseHljs(),Util.parseMarkdown();var t=null,e=($(".article").on("dblclick",".vditor-reset img",function(){clearTimeout(t),$(this).hasClass("emoji")||1===$(this).closest(".editor-panel").length||1===$(this).closest(".ad").length||window.open($(this).attr("src"))}).on("click",".vditor-reset img",function(e){var i,n;clearTimeout(t),$(this).hasClass("emoji")||1===$(this).closest(".editor-panel").length||1===$(this).closest(".ad").length||(i=$(this),n=this,t=setTimeout(function(){var e=n.offsetTop,t=n.offsetLeft;1===i.closest(".comments").length&&(e+=i.closest("li")[0].offsetTop,t=t+$(".comments")[0].offsetLeft+15),$("body").append('
    '),$(".img-preview").css({"background-color":"#fff",position:"fixed"})},100))}),$("#articltVia").data("ua")),e=Util.getDeviceByUa(e),e=(""!==e&&$("#articltVia").text("via "+e),$("#revision").dialog({width:Math.min($(window).width()-50,1e3,.8*$(window).width()),height:$(window).height()-50,modal:!0,hideFooter:!0}),$("#reportDialog").dialog({width:500<$(window).width()?500:$(window).width()-50,height:450,modal:!0,hideFooter:!0}),this.initAudio(),$(window).scroll(function(){var e=$(window).scrollTop();$(".share").css("top",e+60+"px"),e<$(".article-title").offset().top?($(".article-header").css("top","-60px"),$(".nav").show()):($(".article-header").css("top","0"),$(".nav").hide())}),$(window).resize(function(){if($("#articleToC > .module-panel").height($(window).height()-48),$(window).width()<1024)return 0!==$("#articleToC").length&&$(".article-body .wrapper, #articleCommentsPanel, .article-footer").css("margin-right","auto"),!1;var e;1===$("#articleToC").length&&(e=$("#articleToC").width(),e=($(window).width()-e-$(".article-info").width()-30)/3+e,$(".article-body .wrapper, #articleCommentsPanel, .article-footer").css("margin-right",e+"px"))}),location.search.split("r=")[1]);e&&sessionStorage.setItem("r",e.split("&")[0]),$(function(){$.ajax({url:Label.servePath+"/api/article/reward/senders/"+Label.articleOId,method:"GET",async:!1,headers:{csrfToken:Label.csrfToken},success:function(e){if(0===e.code&&""!==e.data){var t=e.data;for(let e=0;e\n
    \n
    \n
    \n")}Util.listenUserCard()}}})})},revision:function(e,n){if(!Label.isLoggedIn)return Util.needLogin(),!1;n=n||"article",$.ajax({url:Label.servePath+"/"+n+"/"+e+"/revisions",cache:!1,success:function(e,t){var i;if(0===e.code)return 0===e.revisions.length||1===e.revisions.length?($("#revision > .revisions").remove(),$("#revisions").html(""+Label.noRevisionLabel+"")):($("#revisions").html("").prev().remove(),$("#revisions").data("revisions",e.revisions).before('
    '+(e.revisions.length-1)+"~"+e.revisions.length+"/"+e.revisions.length+'
    '),e.revisions.length<=2&&$("#revision a").first().addClass("disabled"),i=JsDiff.createPatch("",e.revisions[e.revisions.length-2].revisionData.articleContent||e.revisions[e.revisions.length-2].revisionData.commentContent,e.revisions[e.revisions.length-1].revisionData.articleContent||e.revisions[e.revisions.length-1].revisionData.commentContent,e.revisions[e.revisions.length-2].revisionData.articleTitle||"",e.revisions[e.revisions.length-1].revisionData.articleTitle||""),new Diff2HtmlUI({diff:i}).draw("#revisions",{matching:"lines",outputFormat:"side-by-side",synchronisedScroll:!0}),Article._revisionsControls(n)),!1;Util.alert(e.msg)}}),$("#revision").dialog("open")},_revisionsControls:function(e){var t=$("#revisions").data("revisions");$("#revision a.first").click(function(){var e;$(this).hasClass("disabled")||((e=parseInt($("#revision .revisions").text().split("~")[0]))<=2?$(this).addClass("disabled"):$(this).removeClass("disabled"),2 span").html(e-1+"~"+e+"/"+t.length),e=JsDiff.createPatch("",t[e-2].revisionData.articleContent||t[e-2].revisionData.commentContent,t[e-1].revisionData.articleContent||t[e-1].revisionData.commentContent,t[e-2].revisionData.articleTitle||"",t[e-1].revisionData.articleTitle||""),new Diff2HtmlUI({diff:e}).draw("#revisions",{matching:"lines",outputFormat:"side-by-side",synchronisedScroll:!0}))}),$("#revision a.last").click(function(){var e;$(this).hasClass("disabled")||((e=parseInt($("#revision .revisions span").text().split("~")[0]))>t.length-3?$(this).addClass("disabled"):$(this).removeClass("disabled"),2 span").html(e+1+"~"+(e+2)+"/"+t.length),e=JsDiff.createPatch("",t[e].revisionData.articleContent||t[e].revisionData.commentContent,t[e+1].revisionData.articleContent||t[e+1].revisionData.commentContent,t[e].revisionData.articleTitle||"",t[e+1].revisionData.articleTitle||""),new Diff2HtmlUI({diff:e}).draw("#revisions",{matching:"lines",outputFormat:"side-by-side",synchronisedScroll:!0}))})},share:function(){var o=$("#qrCode").data("shareurl");$("#qrCode").qrcode({width:90,height:90,text:o}),$("body").click(function(){$("#qrCode").slideUp()}),$(".share > span").click(function(){var e,t,i,n=$(this).data("type");return!!n&&("wechat"===n?($("#qrCode").slideToggle(),!1):"copy"!==n&&(e=encodeURIComponent(Label.articleTitle+" - "+Label.symphonyLabel),t=encodeURIComponent(o),i=$(".article-info .avatar-mid").css("background-image"),pic=i.substring(5,i.length-2),(i={}).tencent="http://share.v.t.qq.com/index.php?c=share&a=index&title="+e+"&url="+t+"&pic="+pic,i.weibo="http://v.t.sina.com.cn/share/share.php?title="+e+"&url="+t+"&pic="+pic,i.google="https://plus.google.com/share?url="+t,i.twitter="https://twitter.com/intent/tweet?status="+e+" "+t,void window.open(i[n],"_blank","top=100,left=200,width=648,height=618")))}),$("#qrCode").click(function(){$(this).hide()}),$("#shareClipboard").mouseover(function(){$(this).attr("aria-label",Label.copyLabel)}),Util.clipboard($("#shareClipboard"),$("#shareClipboard").next(),function(){$("#shareClipboard").attr("aria-label",Label.copiedLabel)})},reward:function(e){confirm(Label.rewardConfirmLabel)&&$.ajax({url:Label.servePath+"/article/reward?articleId="+e,type:"POST",cache:!1,success:function(e,t){var i,n;0===e.code?($("#articleRewardContent .vditor-reset").html(e.articleRewardContent),Util.parseHljs(),Util.parseMarkdown(),i=$("#articleRewardContent > span"),n=parseInt(i.text()),i.addClass("ft-red").removeClass("ft-blue").html(n+1+" "+Label.rewardLabel).removeAttr("onclick")):Util.alert(e.msg)},error:function(e){Util.needLogin()}})},thankArticle:function(e,t){return Label.isLoggedIn?!(0===t&&!confirm(Label.thankArticleConfirmLabel))&&(Label.currentUserName===Label.articleAuthorName?(Util.alert(Label.thankSelfLabel),!1):void $.ajax({url:Label.servePath+"/article/thank?articleId="+e,type:"POST",cache:!1,success:function(e,t){var i,n,o;if(0===e.code)return n=parseInt($("#thankArticle").text()),$("#thankArticle").removeAttr("onclick").html(''+(n+1)+"").addClass("ft-red").removeClass("ft-blue"),i=$(''),n=$("#thankArticle").offset().top,o=$("#thankArticle").offset().left,i.css({"z-index":9999,top:n-20,left:o,position:"absolute","font-size":16,"-moz-user-select":"none","-webkit-user-select":"none","-ms-user-select":"none"}),$("body").append(i),i.animate({top:n-180,opacity:0},1500,function(){i.remove()}),!1;Util.alert(e.msg)}})):(Util.needLogin(),!1)},stick:function(e){confirm(Label.stickConfirmLabel)&&$.ajax({url:Label.servePath+"/article/stick?articleId="+e,type:"POST",cache:!1,success:function(e,t){Util.alert(e.msg),window.location.href=Label.servePath+"/recent"}})},playThought:function(e){function i(e,t){3===(e=e.split(l)).length&&e.splice(0,0,"");var i=e[0],n=e[2].split("-"),o=e[3].split("-");if(n[0]=parseInt(n[0]),n[1]=parseInt(n[1]),o[0]=parseInt(o[0]),o[1]=parseInt(o[1]),i===d){for(var a=[],r=n[1];o[1],r span"),a=$("#thoughtProgress > svg"),r="#articleThought",s=e.split(t),m=Math.max(s[s.length-2].split(l)[1]/3e4,2);""===s[s.length-1]&&s.pop();for(var u=0,f=0;u").replace(/ /g," ").replace(/ /g,"    ");$(r).data("text",e).html(t)},parseInt(s[u].split(l)[1])/m);for(var h=0,p=parseInt(s[u-1].split(l)[1])/m,v=setInterval(function(){p<=h?(o.width("100%"),a.css("left","100%"),clearInterval(v)):(h+=20,a.css("left",100*h/p+"%"),o.width(100*h/p+"%"))},20),g="",b="",w=0,C=0,y=0;C").replace(/ /g," ").replace(/ /g,"    "),g=k;$(r).html(b),w=Math.max(w,$(r).height())}$("#thoughtProgressPreview").html('
    '+b+"
    "),$("#thoughtProgressPreview").dialog({modal:!0,hideFooter:!0}),a.click(function(){$("#thoughtProgressPreview").dialog("open")}),$(r).html(b).height(w).css("margin-bottom","15px").html("")},initToc:function(){if(0===$("#articleToC").length)return $(".article-body .wrapper, #articleCommentsPanel, .article-footer").css("margin-right","auto"),!1;var e=$("#articleToC").width(),e=($(window).width()-e-$(".article-info").width()-30)/3+e,a=($(".article-body .wrapper, #articleCommentsPanel, .article-footer").css("margin-right",e+"px"),$("#articleToC > .module-panel").height($(window).height()-48),$("#articleToC")),r=$(".article-toc"),s=$(".article-content [id^=toc]"),l=!1;a.offset().top;toc=[],a.find("li").click(function(){var e=$(this);setTimeout(function(){a.find("li").removeClass("current"),e.addClass("current")},50)}),$(window).scroll(function(e){if(parseInt($("#articleToC").css("right"))<0)return!1;$("#articleToC > .module-panel").height($(window).height()-49),toc=[],s.each(function(e){toc.push({id:this.id,offsetTop:this.offsetTop})});for(var t=$(window).scrollTop(),i=0,n=toc.length;i=toc[toc.length-1].offsetTop-53&&(a.find("li").removeClass("current"),a.find("li:last").addClass("current"));var o=a.find("li.current")[0].offsetTop;l||(r.scrollTop()o-30&&r.scrollTop(o)),setTimeout(function(){l=!1},600)}),$(window).scroll(),r.scrollTop(a.find("li.current")[0].offsetTop).scroll(function(){l=!0})},toggleToc:function(){var e=$("#articleToC");if(0===e.length)return!1;var t=$(".article-header .icon-unordered-list");t.hasClass("ft-red")?(e.animate({right:"-"+$("#articleToC").outerWidth()+"px"}),t.removeClass("ft-red"),$(".article-actions .icon-unordered-list").removeClass("ft-red")):(e.animate({right:0}),t.addClass("ft-red"),$(".article-actions .icon-unordered-list").addClass("ft-red"))},makeNotificationRead:function(e,t){$.ajax({url:Label.servePath+"/notifications/make-read",type:"POST",cache:!1,data:JSON.stringify({articleId:e,commentIds:t})})}};Article.init(),$(document).ready(function(){Comment.init(),Comment.listenUploadEmojis(),Comment.loadEmojis();{let e=(new Date).getTime(),t=0;function i(){0!==t&&(clearTimeout(t),t=0),$("#emojiList").css("top","auto"),$("#emojiList").css("bottom","60px"),e=(new Date).getTime(),t=setTimeout(()=>{(new Date).getTime()-e<=700&&$("#emojiList").removeClass("showList")},null!==navigator.userAgent.match(/(phone|pad|pod|ios|Android|Mobile|BlackBerry|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian)/i)?0:600)}$("#emojiBtn").hover(function(){0!==t&&(clearTimeout(t),t=0),e=(new Date).getTime(),setTimeout(()=>0!==$("#emojiBtn:hover").length&&$("#emojiList").addClass("showList"),300)},i),$("#emojiList").hover(function(){0!==t&&(clearTimeout(t),t=0),e=(new Date).getTime()},i)}ArticleChannel.init(Label.articleChannel),Label.isLoggedIn&&(Article.makeNotificationRead(Label.articleOId,Label.notificationCmtIds),setTimeout(function(){Util.setUnreadNotificationCount()},1e3))}); \ No newline at end of file