Commit a0c79533 authored by Van's avatar Van

📦

parent caf5a86c
...@@ -19,11 +19,12 @@ ...@@ -19,11 +19,12 @@
--> -->
<script> <script>
var Label = { var Label = {
"servePath": "${servePath}", servePath: "${servePath}",
"staticServePath": "${staticServePath}", staticServePath: "${staticServePath}",
"markedAvailable": ${markedAvailable?c}, markedAvailable: ${markedAvailable?c},
"hljsStyle": "atom-one-light", hljsStyle: 'atom-one-light',
"langLabel": "${langLabel}" langLabel: "${langLabel}",
}; version: "${version}",
}
Util.init() Util.init()
</script> </script>
\ No newline at end of file
...@@ -6,7 +6,7 @@ admin.comment={open:function(e,t){this.getList(e,t),$("#"+t+"Comments").dialog(" ...@@ -6,7 +6,7 @@ admin.comment={open:function(e,t){this.getList(e,t),$("#"+t+"Comments").dialog("
admin.articleList={tablePagination:new TablePaginate("article"),init:function(t){this.tablePagination.buildTable([{text:Label.titleLabel,index:"title",minWidth:110,style:"padding-left: 12px;font-size:14px;"},{text:Label.authorLabel,index:"author",width:150,style:"padding-left: 12px;"},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"},{text:Label.viewLabel,width:60,index:"articleViewCount",style:"padding-left: 12px;"},{text:Label.dateLabel,index:"date",width:90,style:"padding-left: 12px;"}]),this.tablePagination.initPagination(),this.tablePagination.initCommentsDialog(),this.getList(t);var e=this;$("#articleListBtn").click(function(){e.getList(t)})},syncToHacpai:function(t){$.ajax({url:Label.servePath+"/console/article/push2rhy?id="+t,type:"GET",cache:!1,success:function(t,e){$("#tipMsg").text(Label.pushSuccLabel)}})},getList:function(c){var o=this;$("#loadMsg").text(Label.loadingLabel),$.ajax({url:Label.servePath+"/console/articles/status/published/"+c+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE+"?k="+$("#articleListInput").val(),type:"GET",cache:!1,success:function(t,e){if($("#tipMsg").text(t.msg),t.sc){for(var a=t.articles,i=[],l=0;l<a.length;l++){i[l]={},i[l].title='<a href="'+Label.servePath+a[l].articlePermalink+"\" target='_blank' title='"+a[l].articleTitle+"' class='no-underline'>"+a[l].articleTitle+"</a><span class='table-tag'>"+a[l].articleTags+"</span>",i[l].date=$.bowknot.getDate(a[l].articleCreateTime),i[l].comments=a[l].articleCommentCount,i[l].articleViewCount=a[l].articleViewCount,i[l].author=a[l].authorName;var n=a[l].articlePutTop?Label.cancelPutTopLabel:Label.putTopLabel;i[l].expendRow="<a href='javascript:void(0)' onclick=\"admin.article.get('"+a[l].oId+"', true)\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.del('"+a[l].oId+"', 'article', '"+encodeURIComponent(a[l].articleTitle)+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.articleList.syncToHacpai('"+a[l].oId+"')\">"+Label.pushToHacpaiLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.articleList.popTop(this, '"+a[l].oId+"')\">"+n+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+a[l].oId+"', 'article')\">"+Label.commentLabel+"</a>"}o.tablePagination.updateTablePagination(i,c,t.pagination),$("#loadMsg").text("")}else $("#loadMsg").text("")}})},popTop:function(t,e){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var a=$(t),i="canceltop",l=Label.putTopLabel;a.html()===Label.putTopLabel&&(i="puttop",l=Label.cancelPutTopLabel),$.ajax({url:Label.servePath+"/console/article/"+i+"/"+e,type:"PUT",cache:!1,success:function(t,e){$("#tipMsg").text(t.msg),t.sc&&a.html(l),$("#loadMsg").text("")}})}},admin.register["article-list"]={obj:admin.articleList,init:admin.articleList.init,refresh:admin.articleList.getList}; admin.articleList={tablePagination:new TablePaginate("article"),init:function(t){this.tablePagination.buildTable([{text:Label.titleLabel,index:"title",minWidth:110,style:"padding-left: 12px;font-size:14px;"},{text:Label.authorLabel,index:"author",width:150,style:"padding-left: 12px;"},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"},{text:Label.viewLabel,width:60,index:"articleViewCount",style:"padding-left: 12px;"},{text:Label.dateLabel,index:"date",width:90,style:"padding-left: 12px;"}]),this.tablePagination.initPagination(),this.tablePagination.initCommentsDialog(),this.getList(t);var e=this;$("#articleListBtn").click(function(){e.getList(t)})},syncToHacpai:function(t){$.ajax({url:Label.servePath+"/console/article/push2rhy?id="+t,type:"GET",cache:!1,success:function(t,e){$("#tipMsg").text(Label.pushSuccLabel)}})},getList:function(c){var o=this;$("#loadMsg").text(Label.loadingLabel),$.ajax({url:Label.servePath+"/console/articles/status/published/"+c+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE+"?k="+$("#articleListInput").val(),type:"GET",cache:!1,success:function(t,e){if($("#tipMsg").text(t.msg),t.sc){for(var a=t.articles,i=[],l=0;l<a.length;l++){i[l]={},i[l].title='<a href="'+Label.servePath+a[l].articlePermalink+"\" target='_blank' title='"+a[l].articleTitle+"' class='no-underline'>"+a[l].articleTitle+"</a><span class='table-tag'>"+a[l].articleTags+"</span>",i[l].date=$.bowknot.getDate(a[l].articleCreateTime),i[l].comments=a[l].articleCommentCount,i[l].articleViewCount=a[l].articleViewCount,i[l].author=a[l].authorName;var n=a[l].articlePutTop?Label.cancelPutTopLabel:Label.putTopLabel;i[l].expendRow="<a href='javascript:void(0)' onclick=\"admin.article.get('"+a[l].oId+"', true)\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.del('"+a[l].oId+"', 'article', '"+encodeURIComponent(a[l].articleTitle)+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.articleList.syncToHacpai('"+a[l].oId+"')\">"+Label.pushToHacpaiLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.articleList.popTop(this, '"+a[l].oId+"')\">"+n+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+a[l].oId+"', 'article')\">"+Label.commentLabel+"</a>"}o.tablePagination.updateTablePagination(i,c,t.pagination),$("#loadMsg").text("")}else $("#loadMsg").text("")}})},popTop:function(t,e){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var a=$(t),i="canceltop",l=Label.putTopLabel;a.html()===Label.putTopLabel&&(i="puttop",l=Label.cancelPutTopLabel),$.ajax({url:Label.servePath+"/console/article/"+i+"/"+e,type:"PUT",cache:!1,success:function(t,e){$("#tipMsg").text(t.msg),t.sc&&a.html(l),$("#loadMsg").text("")}})}},admin.register["article-list"]={obj:admin.articleList,init:admin.articleList.init,refresh:admin.articleList.getList};
admin.draftList={tablePagination:new TablePaginate("draft"),init:function(t){this.tablePagination.buildTable([{text:Label.titleLabel,index:"title",minWidth:110,style:"padding-left: 12px;font-size:14px;"},{text:Label.authorLabel,index:"author",width:150,style:"padding-left: 12px;"},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"},{text:Label.viewLabel,width:60,index:"articleViewCount",style:"padding-left: 12px;"},{text:Label.dateLabel,index:"date",width:90,style:"padding-left: 12px;"}]),this.tablePagination.initPagination(),this.tablePagination.initCommentsDialog(),this.getList(t)},getList:function(n){$("#loadMsg").text(Label.loadingLabel);var d=this;$.ajax({url:Label.servePath+"/console/articles/status/unpublished/"+n+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(t,e){if($("#tipMsg").text(t.msg),t.sc){for(var a=t.articles,i=[],l=0;l<a.length;l++)i[l]={},i[l].tags=a[l].articleTags,i[l].date=$.bowknot.getDate(a[l].articleCreateTime),i[l].comments=a[l].articleCommentCount,i[l].articleViewCount=a[l].articleViewCount,i[l].author=a[l].authorName,i[l].title="<a class='no-underline' href='"+Label.servePath+a[l].articlePermalink+"' target='_blank'>"+a[l].articleTitle+"</a><span class='table-tag'>"+a[l].articleTags+"</span>",i[l].expendRow="<a href='javascript:void(0)' onclick=\"admin.article.get('"+a[l].oId+"', false);\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.del('"+a[l].oId+"', 'draft', '"+encodeURIComponent(a[l].articleTitle)+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+a[l].oId+"', 'draft')\">"+Label.commentLabel+"</a>";d.tablePagination.updateTablePagination(i,n,t.pagination),$("#loadMsg").text("")}else $("#loadMsg").text("")}})}},admin.register["draft-list"]={obj:admin.draftList,init:admin.draftList.init,refresh:admin.draftList.getList}; admin.draftList={tablePagination:new TablePaginate("draft"),init:function(t){this.tablePagination.buildTable([{text:Label.titleLabel,index:"title",minWidth:110,style:"padding-left: 12px;font-size:14px;"},{text:Label.authorLabel,index:"author",width:150,style:"padding-left: 12px;"},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"},{text:Label.viewLabel,width:60,index:"articleViewCount",style:"padding-left: 12px;"},{text:Label.dateLabel,index:"date",width:90,style:"padding-left: 12px;"}]),this.tablePagination.initPagination(),this.tablePagination.initCommentsDialog(),this.getList(t)},getList:function(n){$("#loadMsg").text(Label.loadingLabel);var d=this;$.ajax({url:Label.servePath+"/console/articles/status/unpublished/"+n+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(t,e){if($("#tipMsg").text(t.msg),t.sc){for(var a=t.articles,i=[],l=0;l<a.length;l++)i[l]={},i[l].tags=a[l].articleTags,i[l].date=$.bowknot.getDate(a[l].articleCreateTime),i[l].comments=a[l].articleCommentCount,i[l].articleViewCount=a[l].articleViewCount,i[l].author=a[l].authorName,i[l].title="<a class='no-underline' href='"+Label.servePath+a[l].articlePermalink+"' target='_blank'>"+a[l].articleTitle+"</a><span class='table-tag'>"+a[l].articleTags+"</span>",i[l].expendRow="<a href='javascript:void(0)' onclick=\"admin.article.get('"+a[l].oId+"', false);\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.del('"+a[l].oId+"', 'draft', '"+encodeURIComponent(a[l].articleTitle)+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+a[l].oId+"', 'draft')\">"+Label.commentLabel+"</a>";d.tablePagination.updateTablePagination(i,n,t.pagination),$("#loadMsg").text("")}else $("#loadMsg").text("")}})}},admin.register["draft-list"]={obj:admin.draftList,init:admin.draftList.init,refresh:admin.draftList.getList};
admin.pageList={tablePagination:new TablePaginate("page"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},id:"",type:"link",init:function(e){this.tablePagination.buildTable([{text:"",index:"pageOrder",width:60,style:"padding-left: 12px;font-size:14px;"},{style:"padding-left: 12px;",text:Label.titleLabel,index:"pageTitle",width:300},{style:"padding-left: 12px;",text:Label.permalinkLabel,index:"pagePermalink",minWidth:100},{style:"padding-left: 12px;",text:Label.openMethodLabel,index:"pageTarget",width:120},{style:"padding-left: 12px;",text:Label.typeLabel,index:"pageType",width:80},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"}]),this.tablePagination.initPagination(),this.tablePagination.initCommentsDialog(),this.getList(e),admin.editors.pageEditor=new SoloEditor({id:"pageContent"}),$(".fn-type").click(function(){var e=$(this);e.hasClass("selected")||($(".fn-type").removeClass("selected"),e.addClass("selected"),admin.pageList.type=e.data("type"),"page"===admin.pageList.type?$("#pagePagePanel").slideDown():$("#pagePagePanel").slideUp())})},getList:function(p){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var l=this;$.ajax({url:Label.servePath+"/console/pages/"+p+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(e,a){if($("#tipMsg").text(e.msg),e.sc){var t=e.pages,n=[];admin.pageList.pageInfo.currentCount=t.length,admin.pageList.pageInfo.pageCount=0===e.pagination.paginationPageCount?1:e.pagination.paginationPageCount;for(var i=0;i<t.length;i++){n[i]={},0===i?1===t.length?n[i].pageOrder="":n[i].pageOrder='<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder('+t[i].oId+", "+i+', \'down\');" class="icon-move-down"></span></div>':i===t.length-1?n[i].pageOrder='<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder('+t[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> </div>':n[i].pageOrder='<div class="table-center" style="width:38px"> <span onclick="admin.pageList.changeOrder('+t[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> <span onclick="admin.pageList.changeOrder('+t[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>';var g="";""!==t[i].pageIcon&&(g="<img class='navigation-icon' src='"+t[i].pageIcon+"'/> "),n[i].pageTitle=g+"<a class='no-underline' href='"+t[i].pagePermalink+"' target='_blank'>"+t[i].pageTitle+"</a>",n[i].pagePermalink="<a class='no-underline' href='"+t[i].pagePermalink+"' target='_blank'>"+t[i].pagePermalink+"</a>",n[i].pageTarget=t[i].pageOpenTarget,n[i].pageType=t[i].pageType,n[i].comments=t[i].pageCommentCount,n[i].expendRow="<span><a href='"+t[i].pagePermalink+"' target='_blank'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.pageList.get('"+t[i].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.pageList.del('"+t[i].oId+"', '"+encodeURIComponent(t[i].pageTitle)+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+t[i].oId+"', 'page')\">"+Label.commentLabel+"</a></span>"}l.tablePagination.updateTablePagination(n,p,e.pagination),$("#loadMsg").text("")}else $("#loadMsg").text("")}})},get:function(t){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/page/"+t,type:"GET",cache:!1,success:function(e,a){$("#tipMsg").text(e.msg),e.sc&&(admin.pageList.id=t,$("#pageTitle").val(e.page.pageTitle),$("#pagePermalink").val(e.page.pagePermalink),$("#pageTarget").val(e.page.pageOpenTarget),$("#pageIcon").val(e.page.pageIcon),"page"===e.page.pageType?$($(".fn-type").get(1)).click():$($(".fn-type").get(0)).click(),$("#pageCommentable").prop("checked",e.page.pageCommentable),admin.editors.pageEditor.setContent(e.page.pageContent)),$("#loadMsg").text("")}})},del:function(e,a){confirm(Label.confirmRemoveLabel+Label.navLabel+'"'+Util.htmlDecode(a)+'"?')&&($("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/page/"+e,type:"DELETE",cache:!1,success:function(e,a){if($("#tipMsg").text(e.msg),e.sc){var t=admin.pageList.pageInfo.currentPage;1===admin.pageList.pageInfo.currentCount&&1!==admin.pageList.pageInfo.pageCount&&admin.pageList.pageInfo.currentPage===admin.pageList.pageInfo.pageCount&&(admin.pageList.pageInfo.pageCount--,t=admin.pageList.pageInfo.pageCount);var n=window.location.hash.split("/");t==n[n.length-1]?admin.pageList.getList(t):admin.setHashByPage(t),$("#loadMsg").text("")}else $("#loadMsg").text("")}}))},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e=admin.editors.pageEditor.getContent(),a=$("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g,"");"link"===admin.pageList.type&&(a=Util.proessURL(a));var t={page:{pageTitle:$("#pageTitle").val(),pageContent:e,pagePermalink:a,pageCommentable:$("#pageCommentable").prop("checked"),pageType:admin.pageList.type,pageOpenTarget:$("#pageTarget").val(),pageIcon:$("#pageIcon").val()}};$.ajax({url:Label.servePath+"/console/page/",type:"POST",cache:!1,data:JSON.stringify(t),success:function(e,a){if($("#tipMsg").text(e.msg),e.sc){admin.pageList.id="",$("#pagePermalink").val(""),$("#pageTitle").val(""),$("#pageIcon").val(""),$("#pageCommentable").prop("cheked",!1),$("#pageTarget").val("_self"),$($(".fn-type").get(0)).click(),admin.editors.pageEditor.setContent(""),admin.pageList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.pageList.pageInfo.currentPage===admin.pageList.pageInfo.pageCount&&admin.pageList.pageInfo.pageCount++;var t=window.location.hash.split("/");admin.pageList.pageInfo.pageCount==t[t.length-1]?admin.pageList.getList(admin.pageList.pageInfo.pageCount):admin.setHashByPage(admin.pageList.pageInfo.pageCount),$("#loadMsg").text("")}else $("#loadMsg").text("")}})}},update:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e=admin.editors.pageEditor.getContent(),a=$("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g,"");"link"===admin.pageList.type&&(a=Util.proessURL(a));var t={page:{pageTitle:$("#pageTitle").val(),oId:this.id,pageContent:e,pagePermalink:a,pageCommentable:$("#pageCommentable").prop("checked"),pageType:admin.pageList.type,pageOpenTarget:$("#pageTarget").val(),pageIcon:$("#pageIcon").val()}};$.ajax({url:Label.servePath+"/console/page/",type:"PUT",cache:!1,data:JSON.stringify(t),success:function(e,a){$("#tipMsg").text(e.msg),e.sc&&(admin.pageList.id="",admin.pageList.getList(admin.pageList.pageInfo.currentPage),$("#pageTitle").val(""),$("#pageIcon").val(""),$("#pagePermalink").val(""),$("#pageCommentable").prop("cheked",!1),$("#pageTarget").val("_self"),$($(".fn-type").get(0)).click(),admin.editors.pageEditor.setContent("")),$("#loadMsg").text("")}})}},validate:function(){if(""===$("#pageTitle").val().replace(/\s/g,""))$("#tipMsg").text(Label.titleEmptyLabel),$("#pageTitle").focus();else{if("link"!==admin.pageList.type||""!==$("#pagePermalink").val().replace(/\s/g,""))return!0;$("#tipMsg").text(Label.linkEmptyLabel)}return!1},submit:function(){""!==this.id?this.update():this.add()},changeOrder:function(e,a,t){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var n={oId:e.toString(),direction:t};$.ajax({url:Label.servePath+"/console/page/order/",type:"PUT",cache:!1,data:JSON.stringify(n),success:function(e,a){$("#tipMsg").text(e.msg),admin.pageList.getList(admin.pageList.pageInfo.currentPage),$("#loadMsg").text("")}})}},admin.register["page-list"]={obj:admin.pageList,init:admin.pageList.init,refresh:admin.pageList.getList}; admin.pageList={tablePagination:new TablePaginate("page"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},id:"",type:"link",init:function(e){this.tablePagination.buildTable([{text:"",index:"pageOrder",width:60,style:"padding-left: 12px;font-size:14px;"},{style:"padding-left: 12px;",text:Label.titleLabel,index:"pageTitle",width:300},{style:"padding-left: 12px;",text:Label.permalinkLabel,index:"pagePermalink",minWidth:100},{style:"padding-left: 12px;",text:Label.openMethodLabel,index:"pageTarget",width:120},{style:"padding-left: 12px;",text:Label.typeLabel,index:"pageType",width:80},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"}]),this.tablePagination.initPagination(),this.tablePagination.initCommentsDialog(),this.getList(e),admin.editors.pageEditor=new SoloEditor({id:"pageContent"}),$(".fn-type").click(function(){var e=$(this);e.hasClass("selected")||($(".fn-type").removeClass("selected"),e.addClass("selected"),admin.pageList.type=e.data("type"),"page"===admin.pageList.type?$("#pagePagePanel").slideDown():$("#pagePagePanel").slideUp())})},getList:function(p){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var l=this;$.ajax({url:Label.servePath+"/console/pages/"+p+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(e,a){if($("#tipMsg").text(e.msg),e.sc){var t=e.pages,n=[];admin.pageList.pageInfo.currentCount=t.length,admin.pageList.pageInfo.pageCount=0===e.pagination.paginationPageCount?1:e.pagination.paginationPageCount;for(var i=0;i<t.length;i++){n[i]={},0===i?1===t.length?n[i].pageOrder="":n[i].pageOrder='<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder('+t[i].oId+", "+i+', \'down\');" class="icon-move-down"></span></div>':i===t.length-1?n[i].pageOrder='<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder('+t[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> </div>':n[i].pageOrder='<div class="table-center" style="width:38px"> <span onclick="admin.pageList.changeOrder('+t[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> <span onclick="admin.pageList.changeOrder('+t[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>';var g="";""!==t[i].pageIcon&&(g="<img class='navigation-icon' src='"+t[i].pageIcon+"'/> "),n[i].pageTitle=g+"<a class='no-underline' href='"+t[i].pagePermalink+"' target='_blank'>"+t[i].pageTitle+"</a>",n[i].pagePermalink="<a class='no-underline' href='"+t[i].pagePermalink+"' target='_blank'>"+t[i].pagePermalink+"</a>",n[i].pageTarget=t[i].pageOpenTarget,n[i].pageType=t[i].pageType,n[i].comments=t[i].pageCommentCount,n[i].expendRow="<span><a href='"+t[i].pagePermalink+"' target='_blank'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.pageList.get('"+t[i].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.pageList.del('"+t[i].oId+"', '"+encodeURIComponent(t[i].pageTitle)+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+t[i].oId+"', 'page')\">"+Label.commentLabel+"</a></span>"}l.tablePagination.updateTablePagination(n,p,e.pagination),$("#loadMsg").text("")}else $("#loadMsg").text("")}})},get:function(t){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/page/"+t,type:"GET",cache:!1,success:function(e,a){$("#tipMsg").text(e.msg),e.sc&&(admin.pageList.id=t,$("#pageTitle").val(e.page.pageTitle),$("#pagePermalink").val(e.page.pagePermalink),$("#pageTarget").val(e.page.pageOpenTarget),$("#pageIcon").val(e.page.pageIcon),"page"===e.page.pageType?$($(".fn-type").get(1)).click():$($(".fn-type").get(0)).click(),$("#pageCommentable").prop("checked",e.page.pageCommentable),admin.editors.pageEditor.setContent(e.page.pageContent)),$("#loadMsg").text("")}})},del:function(e,a){confirm(Label.confirmRemoveLabel+Label.navLabel+'"'+Util.htmlDecode(a)+'"?')&&($("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/page/"+e,type:"DELETE",cache:!1,success:function(e,a){if($("#tipMsg").text(e.msg),e.sc){var t=admin.pageList.pageInfo.currentPage;1===admin.pageList.pageInfo.currentCount&&1!==admin.pageList.pageInfo.pageCount&&admin.pageList.pageInfo.currentPage===admin.pageList.pageInfo.pageCount&&(admin.pageList.pageInfo.pageCount--,t=admin.pageList.pageInfo.pageCount);var n=window.location.hash.split("/");t==n[n.length-1]?admin.pageList.getList(t):admin.setHashByPage(t),$("#loadMsg").text("")}else $("#loadMsg").text("")}}))},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e=admin.editors.pageEditor.getContent(),a=$("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g,"");"link"===admin.pageList.type&&(a=Util.proessURL(a));var t={page:{pageTitle:$("#pageTitle").val(),pageContent:e,pagePermalink:a,pageCommentable:$("#pageCommentable").prop("checked"),pageType:admin.pageList.type,pageOpenTarget:$("#pageTarget").val(),pageIcon:$("#pageIcon").val()}};$.ajax({url:Label.servePath+"/console/page/",type:"POST",cache:!1,data:JSON.stringify(t),success:function(e,a){if($("#tipMsg").text(e.msg),e.sc){admin.pageList.id="",$("#pagePermalink").val(""),$("#pageTitle").val(""),$("#pageIcon").val(""),$("#pageCommentable").prop("cheked",!1),$("#pageTarget").val("_self"),$($(".fn-type").get(0)).click(),admin.editors.pageEditor.setContent(""),admin.pageList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.pageList.pageInfo.currentPage===admin.pageList.pageInfo.pageCount&&admin.pageList.pageInfo.pageCount++;var t=window.location.hash.split("/");admin.pageList.pageInfo.pageCount==t[t.length-1]?admin.pageList.getList(admin.pageList.pageInfo.pageCount):admin.setHashByPage(admin.pageList.pageInfo.pageCount),$("#loadMsg").text("")}else $("#loadMsg").text("")}})}},update:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e=admin.editors.pageEditor.getContent(),a=$("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g,"");"link"===admin.pageList.type&&(a=Util.proessURL(a));var t={page:{pageTitle:$("#pageTitle").val(),oId:this.id,pageContent:e,pagePermalink:a,pageCommentable:$("#pageCommentable").prop("checked"),pageType:admin.pageList.type,pageOpenTarget:$("#pageTarget").val(),pageIcon:$("#pageIcon").val()}};$.ajax({url:Label.servePath+"/console/page/",type:"PUT",cache:!1,data:JSON.stringify(t),success:function(e,a){$("#tipMsg").text(e.msg),e.sc&&(admin.pageList.id="",admin.pageList.getList(admin.pageList.pageInfo.currentPage),$("#pageTitle").val(""),$("#pageIcon").val(""),$("#pagePermalink").val(""),$("#pageCommentable").prop("cheked",!1),$("#pageTarget").val("_self"),$($(".fn-type").get(0)).click(),admin.editors.pageEditor.setContent("")),$("#loadMsg").text("")}})}},validate:function(){if(""===$("#pageTitle").val().replace(/\s/g,""))$("#tipMsg").text(Label.titleEmptyLabel),$("#pageTitle").focus();else{if("link"!==admin.pageList.type||""!==$("#pagePermalink").val().replace(/\s/g,""))return!0;$("#tipMsg").text(Label.linkEmptyLabel)}return!1},submit:function(){""!==this.id?this.update():this.add()},changeOrder:function(e,a,t){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var n={oId:e.toString(),direction:t};$.ajax({url:Label.servePath+"/console/page/order/",type:"PUT",cache:!1,data:JSON.stringify(n),success:function(e,a){$("#tipMsg").text(e.msg),admin.pageList.getList(admin.pageList.pageInfo.currentPage),$("#loadMsg").text("")}})}},admin.register["page-list"]={obj:admin.pageList,init:admin.pageList.init,refresh:admin.pageList.getList};
admin.others={init:function(){$("#tabOthers").tabs(),$("#loadMsg").text("")},removeUnusedTags:function(){$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/tag/unused",type:"DELETE",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg)}})},exportSQL:function(){$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/export/sql",type:"GET",cache:!1,success:function(e,t){e.sc?$("#tipMsg").text(e.msg):window.location=Label.servePath+"/console/export/sql"}})},exportJSON:function(){$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/export/json",type:"GET",cache:!1,success:function(e,t){e.sc?$("#tipMsg").text(e.msg):window.location=Label.servePath+"/console/export/json"}})},exportHexo:function(){$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/export/hexo",type:"GET",cache:!1,success:function(e,t){e.sc?$("#tipMsg").text(e.msg):window.location=Label.servePath+"/console/export/hexo"}})},getUnusedTags:function(){$.ajax({url:Label.servePath+"/console/tag/unused",type:"GET",cache:!1,success:function(e,t){($("#tipMsg").text(e.msg),e.sc)?e.unusedTags.length:$("#loadMsg").text("")}})}},admin.register.others={obj:admin.others,init:admin.others.init,refresh:function(){admin.clearTip()}}; admin.others={init:function(){$("#tabOthers").tabs(),$("#loadMsg").text("")},removeUnusedArchives:function(){$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/archive/unused",type:"DELETE",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg)}})},removeUnusedTags:function(){$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/tag/unused",type:"DELETE",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg)}})},exportSQL:function(){$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/export/sql",type:"GET",cache:!1,success:function(e,t){e.sc?$("#tipMsg").text(e.msg):window.location=Label.servePath+"/console/export/sql"}})},exportJSON:function(){$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/export/json",type:"GET",cache:!1,success:function(e,t){e.sc?$("#tipMsg").text(e.msg):window.location=Label.servePath+"/console/export/json"}})},exportHexo:function(){$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/export/hexo",type:"GET",cache:!1,success:function(e,t){e.sc?$("#tipMsg").text(e.msg):window.location=Label.servePath+"/console/export/hexo"}})},getUnusedTags:function(){$.ajax({url:Label.servePath+"/console/tag/unused",type:"GET",cache:!1,success:function(e,t){($("#tipMsg").text(e.msg),e.sc)?e.unusedTags.length:$("#loadMsg").text("")}})}},admin.register.others={obj:admin.others,init:admin.others.init,refresh:function(){admin.clearTip()}};
admin.linkList={tablePagination:new TablePaginate("link"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},id:"",init:function(i){this.tablePagination.buildTable([{text:"",index:"linkOrder",width:60},{style:"padding-left: 12px;",text:Label.linkTitleLabel,index:"linkTitle",width:230},{style:"padding-left: 12px;",text:Label.urlLabel,index:"linkAddress",minWidth:180},{style:"padding-left: 12px;",text:Label.linkDescriptionLabel,index:"linkDescription",width:360}]),this.tablePagination.initPagination(),this.getList(i),$("#updateLink").dialog({title:$("#updateLink").data("title"),width:700,height:290,modal:!0,hideFooter:!0})},getList:function(l){$("#loadMsg").text(Label.loadingLabel),0===l&&(l=1),this.pageInfo.currentPage=l;var s=this;$.ajax({url:Label.servePath+"/console/links/"+l+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(i,e){if($("#tipMsg").text(i.msg),i.sc){var n=i.links,t=[];admin.linkList.pageInfo.currentCount=n.length,admin.linkList.pageInfo.pageCount=0===i.pagination.paginationPageCount?1:i.pagination.paginationPageCount;for(var a=0;a<n.length;a++)t[a]={},0===a?1===n.length?t[a].linkOrder="":t[a].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder('+n[a].oId+", "+a+', \'down\');" class="icon-move-down"></span> </div>':a===n.length-1?t[a].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder('+n[a].oId+", "+a+', \'up\');" class="icon-move-up"></span> </div>':t[a].linkOrder='<div class="table-center" style="width:38px"> <span onclick="admin.linkList.changeOrder('+n[a].oId+", "+a+', \'up\');" class="icon-move-up"></span> <span onclick="admin.linkList.changeOrder('+n[a].oId+", "+a+', \'down\');" class="icon-move-down"></span> </div>',t[a].linkTitle=n[a].linkTitle,t[a].linkAddress="<a target='_blank' class='no-underline' href='"+n[a].linkAddress+"'>"+n[a].linkAddress+"</a>",t[a].linkDescription=n[a].linkDescription,t[a].expendRow="<span><a href='"+n[a].linkAddress+"' target='_blank'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.linkList.get('"+n[a].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.linkList.del('"+n[a].oId+"', '"+encodeURIComponent(n[a].linkTitle)+"')\">"+Label.removeLabel+"</a></span>";s.tablePagination.updateTablePagination(t,l,i.pagination),$("#loadMsg").text("")}else $("#loadMsg").text("")}})},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var i={link:{linkTitle:$("#linkTitle").val(),linkAddress:$("#linkAddress").val(),linkDescription:$("#linkDescription").val()}};$.ajax({url:Label.servePath+"/console/link/",type:"POST",cache:!1,data:JSON.stringify(i),success:function(i,e){if($("#tipMsg").text(i.msg),i.sc){$("#linkTitle").val(""),$("#linkAddress").val(""),$("#linkDescription").val(""),admin.linkList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.linkList.pageInfo.currentPage===admin.linkList.pageInfo.pageCount&&admin.linkList.pageInfo.pageCount++;var n=window.location.hash.split("/");admin.linkList.pageInfo.pageCount!==parseInt(n[n.length-1])&&admin.setHashByPage(admin.linkList.pageInfo.pageCount),admin.linkList.getList(admin.linkList.pageInfo.pageCount),$("#loadMsg").text("")}else $("#loadMsg").text("")}})}},get:function(n){$("#loadMsg").text(Label.loadingLabel),$("#updateLink").dialog("open"),$.ajax({url:Label.servePath+"/console/link/"+n,type:"GET",cache:!1,success:function(i,e){$("#tipMsg").text(i.msg),i.sc&&(admin.linkList.id=n,$("#linkTitleUpdate").val(i.link.linkTitle),$("#linkAddressUpdate").val(i.link.linkAddress),$("#linkDescriptionUpdate").val(i.link.linkDescription)),$("#loadMsg").text("")}})},update:function(){if(this.validate("Update")){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var i={link:{linkTitle:$("#linkTitleUpdate").val(),oId:this.id,linkAddress:$("#linkAddressUpdate").val(),linkDescription:$("#linkDescriptionUpdate").val()}};$.ajax({url:Label.servePath+"/console/link/",type:"PUT",cache:!1,data:JSON.stringify(i),success:function(i,e){$("#updateLink").dialog("close"),$("#tipMsg").text(i.msg),i.sc&&admin.linkList.getList(admin.linkList.pageInfo.currentPage),$("#loadMsg").text("")}})}},del:function(i,e){confirm(Label.confirmRemoveLabel+Label.permalinkLabel+'"'+Util.htmlDecode(e)+'"?')&&($("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/link/"+i,type:"DELETE",cache:!1,success:function(i,e){if($("#tipMsg").text(i.msg),i.sc){var n=admin.linkList.pageInfo.currentPage;1===admin.linkList.pageInfo.currentCount&&1!==admin.linkList.pageInfo.pageCount&&admin.linkList.pageInfo.currentPage===admin.linkList.pageInfo.pageCount&&(admin.linkList.pageInfo.pageCount--,n=admin.linkList.pageInfo.pageCount);var t=window.location.hash.split("/");n!==parseInt(t[t.length-1])&&admin.setHashByPage(n),admin.linkList.getList(n),$("#loadMsg").text("")}else $("#loadMsg").text("")}}))},validate:function(i){if(i||(i=""),""===$("#linkTitle"+i).val().replace(/\s/g,""))$("#tipMsg").text(Label.titleEmptyLabel),$("#linkTitle"+i).focus().val("");else if(""===$("#linkAddress"+i).val().replace(/\s/g,""))$("#tipMsg").text(Label.addressEmptyLabel),$("#linkAddress"+i).focus().val("");else{if(/^\w+:\/\//.test($("#linkAddress"+i).val()))return!0;$("#tipMsg").text(Label.addressInvalidLabel),$("#linkAddress"+i).focus().val("")}return!1},changeOrder:function(i,e,n){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var t={oId:i.toString(),direction:n};$.ajax({url:Label.servePath+"/console/link/order/",type:"PUT",cache:!1,data:JSON.stringify(t),success:function(i,e){$("#tipMsg").text(i.msg),admin.linkList.getList(admin.linkList.pageInfo.currentPage),$("#loadMsg").text("")}})}},admin.register["link-list"]={obj:admin.linkList,init:admin.linkList.init,refresh:admin.linkList.getList}; admin.linkList={tablePagination:new TablePaginate("link"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},id:"",init:function(i){this.tablePagination.buildTable([{text:"",index:"linkOrder",width:60},{style:"padding-left: 12px;",text:Label.linkTitleLabel,index:"linkTitle",width:230},{style:"padding-left: 12px;",text:Label.urlLabel,index:"linkAddress",minWidth:180},{style:"padding-left: 12px;",text:Label.linkDescriptionLabel,index:"linkDescription",width:360}]),this.tablePagination.initPagination(),this.getList(i),$("#updateLink").dialog({title:$("#updateLink").data("title"),width:700,height:290,modal:!0,hideFooter:!0})},getList:function(l){$("#loadMsg").text(Label.loadingLabel),0===l&&(l=1),this.pageInfo.currentPage=l;var s=this;$.ajax({url:Label.servePath+"/console/links/"+l+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(i,e){if($("#tipMsg").text(i.msg),i.sc){var n=i.links,t=[];admin.linkList.pageInfo.currentCount=n.length,admin.linkList.pageInfo.pageCount=0===i.pagination.paginationPageCount?1:i.pagination.paginationPageCount;for(var a=0;a<n.length;a++)t[a]={},0===a?1===n.length?t[a].linkOrder="":t[a].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder('+n[a].oId+", "+a+', \'down\');" class="icon-move-down"></span> </div>':a===n.length-1?t[a].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder('+n[a].oId+", "+a+', \'up\');" class="icon-move-up"></span> </div>':t[a].linkOrder='<div class="table-center" style="width:38px"> <span onclick="admin.linkList.changeOrder('+n[a].oId+", "+a+', \'up\');" class="icon-move-up"></span> <span onclick="admin.linkList.changeOrder('+n[a].oId+", "+a+', \'down\');" class="icon-move-down"></span> </div>',t[a].linkTitle=n[a].linkTitle,t[a].linkAddress="<a target='_blank' class='no-underline' href='"+n[a].linkAddress+"'>"+n[a].linkAddress+"</a>",t[a].linkDescription=n[a].linkDescription,t[a].expendRow="<span><a href='"+n[a].linkAddress+"' target='_blank'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.linkList.get('"+n[a].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.linkList.del('"+n[a].oId+"', '"+encodeURIComponent(n[a].linkTitle)+"')\">"+Label.removeLabel+"</a></span>";s.tablePagination.updateTablePagination(t,l,i.pagination),$("#loadMsg").text("")}else $("#loadMsg").text("")}})},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var i={link:{linkTitle:$("#linkTitle").val(),linkAddress:$("#linkAddress").val(),linkDescription:$("#linkDescription").val()}};$.ajax({url:Label.servePath+"/console/link/",type:"POST",cache:!1,data:JSON.stringify(i),success:function(i,e){if($("#tipMsg").text(i.msg),i.sc){$("#linkTitle").val(""),$("#linkAddress").val(""),$("#linkDescription").val(""),admin.linkList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.linkList.pageInfo.currentPage===admin.linkList.pageInfo.pageCount&&admin.linkList.pageInfo.pageCount++;var n=window.location.hash.split("/");admin.linkList.pageInfo.pageCount!==parseInt(n[n.length-1])&&admin.setHashByPage(admin.linkList.pageInfo.pageCount),admin.linkList.getList(admin.linkList.pageInfo.pageCount),$("#loadMsg").text("")}else $("#loadMsg").text("")}})}},get:function(n){$("#loadMsg").text(Label.loadingLabel),$("#updateLink").dialog("open"),$.ajax({url:Label.servePath+"/console/link/"+n,type:"GET",cache:!1,success:function(i,e){$("#tipMsg").text(i.msg),i.sc&&(admin.linkList.id=n,$("#linkTitleUpdate").val(i.link.linkTitle),$("#linkAddressUpdate").val(i.link.linkAddress),$("#linkDescriptionUpdate").val(i.link.linkDescription)),$("#loadMsg").text("")}})},update:function(){if(this.validate("Update")){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var i={link:{linkTitle:$("#linkTitleUpdate").val(),oId:this.id,linkAddress:$("#linkAddressUpdate").val(),linkDescription:$("#linkDescriptionUpdate").val()}};$.ajax({url:Label.servePath+"/console/link/",type:"PUT",cache:!1,data:JSON.stringify(i),success:function(i,e){$("#updateLink").dialog("close"),$("#tipMsg").text(i.msg),i.sc&&admin.linkList.getList(admin.linkList.pageInfo.currentPage),$("#loadMsg").text("")}})}},del:function(i,e){confirm(Label.confirmRemoveLabel+Label.permalinkLabel+'"'+Util.htmlDecode(e)+'"?')&&($("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text(""),$.ajax({url:Label.servePath+"/console/link/"+i,type:"DELETE",cache:!1,success:function(i,e){if($("#tipMsg").text(i.msg),i.sc){var n=admin.linkList.pageInfo.currentPage;1===admin.linkList.pageInfo.currentCount&&1!==admin.linkList.pageInfo.pageCount&&admin.linkList.pageInfo.currentPage===admin.linkList.pageInfo.pageCount&&(admin.linkList.pageInfo.pageCount--,n=admin.linkList.pageInfo.pageCount);var t=window.location.hash.split("/");n!==parseInt(t[t.length-1])&&admin.setHashByPage(n),admin.linkList.getList(n),$("#loadMsg").text("")}else $("#loadMsg").text("")}}))},validate:function(i){if(i||(i=""),""===$("#linkTitle"+i).val().replace(/\s/g,""))$("#tipMsg").text(Label.titleEmptyLabel),$("#linkTitle"+i).focus().val("");else if(""===$("#linkAddress"+i).val().replace(/\s/g,""))$("#tipMsg").text(Label.addressEmptyLabel),$("#linkAddress"+i).focus().val("");else{if(/^\w+:\/\//.test($("#linkAddress"+i).val()))return!0;$("#tipMsg").text(Label.addressInvalidLabel),$("#linkAddress"+i).focus().val("")}return!1},changeOrder:function(i,e,n){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var t={oId:i.toString(),direction:n};$.ajax({url:Label.servePath+"/console/link/order/",type:"PUT",cache:!1,data:JSON.stringify(t),success:function(i,e){$("#tipMsg").text(i.msg),admin.linkList.getList(admin.linkList.pageInfo.currentPage),$("#loadMsg").text("")}})}},admin.register["link-list"]={obj:admin.linkList,init:admin.linkList.init,refresh:admin.linkList.getList};
admin.preference={locale:"",init:function(){$("#tabPreference").tabs(),$.ajax({url:Label.servePath+"/console/preference/",type:"GET",cache:!1,success:function(result,textStatus){if($("#tipMsg").text(result.msg),result.sc){var preference=result.preference;$("#metaKeywords").val(preference.metaKeywords),$("#metaDescription").val(preference.metaDescription),$("#blogTitle").val(preference.blogTitle),$("#blogSubtitle").val(preference.blogSubtitle),$("#mostCommentArticleDisplayCount").val(preference.mostCommentArticleDisplayCount),$("#mostViewArticleDisplayCount").val(preference.mostViewArticleDisplayCount),$("#recentCommentDisplayCount").val(preference.recentCommentDisplayCount),$("#mostUsedTagDisplayCount").val(preference.mostUsedTagDisplayCount),$("#articleListDisplayCount").val(preference.articleListDisplayCount),$("#articleListPaginationWindowSize").val(preference.articleListPaginationWindowSize),$("#localeString").val(preference.localeString),$("#timeZoneId").val(preference.timeZoneId),$("#noticeBoard").val(preference.noticeBoard),$("#footerContent").val(preference.footerContent),$("#htmlHead").val(preference.htmlHead),$("#externalRelevantArticlesDisplayCount").val(preference.externalRelevantArticlesDisplayCount),$("#relevantArticlesDisplayCount").val(preference.relevantArticlesDisplayCount),$("#randomArticlesDisplayCount").val(preference.randomArticlesDisplayCount),$("#customVars").val(preference.customVars),"true"===preference.enableArticleUpdateHint?$("#enableArticleUpdateHint").attr("checked","checked"):$("#enableArticleUpdateHint").removeAttr("checked"),"true"===preference.allowVisitDraftViaPermalink?$("#allowVisitDraftViaPermalink").attr("checked","checked"):$("allowVisitDraftViaPermalink").removeAttr("checked"),"true"===preference.commentable?$("#commentable").attr("checked","checked"):$("commentable").removeAttr("checked"),"true"===preference.syncGitHub?$("#syncGitHub").attr("checked","checked"):$("syncGitHub").removeAttr("checked"),syncGitHub,admin.preference.locale=preference.localeString,$("#skinMain").data("skinDirName",preference.skinDirName);for(var skins=eval("("+preference.skins+")"),skinsHTML="",i=0;i<skins.length;i++){var selectedClass="";skins[i].skinName===preference.skinName&&skins[i].skinDirName===preference.skinDirName&&(selectedClass+=" selected"),skinsHTML+='<div class="fn__left skinItem'+selectedClass+'"><div class="ft__center">'+skins[i].skinName+'</div><img class="skinPreview" src="'+Label.staticServePath+"/skins/"+skins[i].skinDirName+'/preview.png"/><div><button class="update small" data-name="'+skins[i].skinDirName+'">'+Label.enableLabel+'</button><button class="small" onclick="window.open(\''+Label.servePath+"?skin="+skins[i].skinName+"')\">"+Label.previewLabel+"</button></div></div>"}$("#skinMain").append(skinsHTML+"<div class='fn__clear'></div>"),$(".skinItem .update").click(function(){$(".skinItem").removeClass("selected"),$(this).closest(".skinItem").addClass("selected"),$("#skinMain").data("skinDirName",$(this).data("name")),admin.preference.update()});for(var signs=eval("("+preference.signs+")"),j=1;j<signs.length;j++)$("#preferenceSign"+j).val(signs[j].signHTML);$("#articleListDisplay").val(preference.articleListStyle),$("#feedOutputMode").val(preference.feedOutputMode),$("#feedOutputCnt").val(preference.feedOutputCnt),$("#faviconURL").val(preference.faviconURL),$("#loadMsg").text("")}else $("#loadMsg").text("")}})},validate:function(){return/^\d+$/.test($("#mostUsedTagDisplayCount").val())?/^\d+$/.test($("#recentCommentDisplayCount").val())?/^\d+$/.test($("#mostCommentArticleDisplayCount").val())?/^\d+$/.test($("#mostViewArticleDisplayCount").val())?/^\d+$/.test($("#articleListDisplayCount").val())?/^\d+$/.test($("#articleListPaginationWindowSize").val())?/^\d+$/.test($("#randomArticlesDisplayCount").val())?/^\d+$/.test($("#relevantArticlesDisplayCount").val())?!!/^\d+$/.test($("#externalRelevantArticlesDisplayCount").val())||($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.externalRelevantArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#externalRelevantArticlesDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.relevantArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#relevantArticlesDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.randomArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#randomArticlesDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.windowSizeLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#articleListPaginationWindowSize").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.pageSizeLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#articleListDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexMostViewArticleDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#mostViewArticleDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexMostCommentArticleDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#mostCommentArticleDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexRecentCommentDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#recentCommentDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexTagDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#mostUsedTagDisplayCount").focus(),!1)},update:function(){if(admin.preference.validate()){$("#tipMsg").text(""),$("#loadMsg").text(Label.loadingLabel);var e=[{oId:0,signHTML:""},{oId:1,signHTML:$("#preferenceSign1").val()},{oId:2,signHTML:$("#preferenceSign2").val()},{oId:3,signHTML:$("#preferenceSign3").val()}],t={preference:{metaKeywords:$("#metaKeywords").val(),metaDescription:$("#metaDescription").val(),blogTitle:$("#blogTitle").val(),blogSubtitle:$("#blogSubtitle").val(),mostCommentArticleDisplayCount:$("#mostCommentArticleDisplayCount").val(),mostViewArticleDisplayCount:$("#mostViewArticleDisplayCount").val(),recentCommentDisplayCount:$("#recentCommentDisplayCount").val(),mostUsedTagDisplayCount:$("#mostUsedTagDisplayCount").val(),articleListDisplayCount:$("#articleListDisplayCount").val(),articleListPaginationWindowSize:$("#articleListPaginationWindowSize").val(),skinDirName:$("#skinMain").data("skinDirName"),localeString:$("#localeString").val(),timeZoneId:$("#timeZoneId").val(),noticeBoard:$("#noticeBoard").val(),footerContent:$("#footerContent").val(),htmlHead:$("#htmlHead").val(),externalRelevantArticlesDisplayCount:$("#externalRelevantArticlesDisplayCount").val(),relevantArticlesDisplayCount:$("#relevantArticlesDisplayCount").val(),randomArticlesDisplayCount:$("#randomArticlesDisplayCount").val(),enableArticleUpdateHint:$("#enableArticleUpdateHint").prop("checked"),signs:e,allowVisitDraftViaPermalink:$("#allowVisitDraftViaPermalink").prop("checked"),articleListStyle:$("#articleListDisplay").val(),feedOutputMode:$("#feedOutputMode").val(),feedOutputCnt:$("#feedOutputCnt").val(),faviconURL:$("#faviconURL").val(),syncGitHub:$("#syncGitHub").prop("checked"),commentable:$("#commentable").prop("checked"),customVars:$("#customVars").val()}};$.ajax({url:Label.servePath+"/console/preference/",type:"PUT",cache:!1,data:JSON.stringify(t),success:function(e,t){$("#tipMsg").text(e.msg),e.sc&&$("#localeString").val()!==admin.preference.locale&&window.location.reload(),$("#loadMsg").text("")}})}}},admin.register.preference={obj:admin.preference,init:admin.preference.init,refresh:function(){admin.clearTip()}}; admin.preference={locale:"",init:function(){$("#tabPreference").tabs(),$.ajax({url:Label.servePath+"/console/preference/",type:"GET",cache:!1,success:function(result,textStatus){if($("#tipMsg").text(result.msg),result.sc){var preference=result.preference;$("#metaKeywords").val(preference.metaKeywords),$("#metaDescription").val(preference.metaDescription),$("#blogTitle").val(preference.blogTitle),$("#blogSubtitle").val(preference.blogSubtitle),$("#mostCommentArticleDisplayCount").val(preference.mostCommentArticleDisplayCount),$("#mostViewArticleDisplayCount").val(preference.mostViewArticleDisplayCount),$("#recentCommentDisplayCount").val(preference.recentCommentDisplayCount),$("#mostUsedTagDisplayCount").val(preference.mostUsedTagDisplayCount),$("#articleListDisplayCount").val(preference.articleListDisplayCount),$("#articleListPaginationWindowSize").val(preference.articleListPaginationWindowSize),$("#localeString").val(preference.localeString),$("#timeZoneId").val(preference.timeZoneId),$("#noticeBoard").val(preference.noticeBoard),$("#footerContent").val(preference.footerContent),$("#htmlHead").val(preference.htmlHead),$("#externalRelevantArticlesDisplayCount").val(preference.externalRelevantArticlesDisplayCount),$("#relevantArticlesDisplayCount").val(preference.relevantArticlesDisplayCount),$("#randomArticlesDisplayCount").val(preference.randomArticlesDisplayCount),$("#customVars").val(preference.customVars),"true"===preference.enableArticleUpdateHint?$("#enableArticleUpdateHint").attr("checked","checked"):$("#enableArticleUpdateHint").removeAttr("checked"),"true"===preference.allowVisitDraftViaPermalink?$("#allowVisitDraftViaPermalink").attr("checked","checked"):$("allowVisitDraftViaPermalink").removeAttr("checked"),"true"===preference.commentable?$("#commentable").attr("checked","checked"):$("commentable").removeAttr("checked"),"true"===preference.syncGitHub?$("#syncGitHub").attr("checked","checked"):$("syncGitHub").removeAttr("checked"),syncGitHub,admin.preference.locale=preference.localeString,$("#skinMain").data("skinDirName",preference.skinDirName);for(var skins=eval("("+preference.skins+")"),skinsHTML="",i=0;i<skins.length;i++){var selectedClass="";skins[i].skinName===preference.skinName&&skins[i].skinDirName===preference.skinDirName&&(selectedClass+=" selected"),skinsHTML+='<div class="fn__left skinItem'+selectedClass+'"><div class="ft__center">'+skins[i].skinName+'</div><img class="skinPreview" src="'+Label.staticServePath+"/skins/"+skins[i].skinDirName+'/preview.png"/><div><button class="update small" data-name="'+skins[i].skinDirName+'">'+Label.enableLabel+'</button><button class="small" onclick="window.open(\''+Label.servePath+"?skin="+skins[i].skinName+"')\">"+Label.previewLabel+"</button></div></div>"}$("#skinMain").append(skinsHTML+"<div class='fn__clear'></div>"),$(".skinItem .update").click(function(){$(".skinItem").removeClass("selected"),$(this).closest(".skinItem").addClass("selected"),$("#skinMain").data("skinDirName",$(this).data("name")),admin.preference.update()});for(var signs=eval("("+preference.signs+")"),j=1;j<signs.length;j++)$("#preferenceSign"+j).val(signs[j].signHTML);$("#articleListDisplay").val(preference.articleListStyle),$("#feedOutputMode").val(preference.feedOutputMode),$("#feedOutputCnt").val(preference.feedOutputCnt),$("#faviconURL").val(preference.faviconURL),$("#loadMsg").text("")}else $("#loadMsg").text("")}})},validate:function(){return/^\d+$/.test($("#mostUsedTagDisplayCount").val())?/^\d+$/.test($("#recentCommentDisplayCount").val())?/^\d+$/.test($("#mostCommentArticleDisplayCount").val())?/^\d+$/.test($("#mostViewArticleDisplayCount").val())?/^\d+$/.test($("#articleListDisplayCount").val())?/^\d+$/.test($("#articleListPaginationWindowSize").val())?/^\d+$/.test($("#randomArticlesDisplayCount").val())?/^\d+$/.test($("#relevantArticlesDisplayCount").val())?!!/^\d+$/.test($("#externalRelevantArticlesDisplayCount").val())||($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.externalRelevantArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#externalRelevantArticlesDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.relevantArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#relevantArticlesDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.randomArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#randomArticlesDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.windowSizeLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#articleListPaginationWindowSize").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.pageSizeLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#articleListDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexMostViewArticleDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#mostViewArticleDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexMostCommentArticleDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#mostCommentArticleDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexRecentCommentDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#recentCommentDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexTagDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#mostUsedTagDisplayCount").focus(),!1)},update:function(){if(admin.preference.validate()){$("#tipMsg").text(""),$("#loadMsg").text(Label.loadingLabel);var e=[{oId:0,signHTML:""},{oId:1,signHTML:$("#preferenceSign1").val()},{oId:2,signHTML:$("#preferenceSign2").val()},{oId:3,signHTML:$("#preferenceSign3").val()}],t={preference:{metaKeywords:$("#metaKeywords").val(),metaDescription:$("#metaDescription").val(),blogTitle:$("#blogTitle").val(),blogSubtitle:$("#blogSubtitle").val(),mostCommentArticleDisplayCount:$("#mostCommentArticleDisplayCount").val(),mostViewArticleDisplayCount:$("#mostViewArticleDisplayCount").val(),recentCommentDisplayCount:$("#recentCommentDisplayCount").val(),mostUsedTagDisplayCount:$("#mostUsedTagDisplayCount").val(),articleListDisplayCount:$("#articleListDisplayCount").val(),articleListPaginationWindowSize:$("#articleListPaginationWindowSize").val(),skinDirName:$("#skinMain").data("skinDirName"),localeString:$("#localeString").val(),timeZoneId:$("#timeZoneId").val(),noticeBoard:$("#noticeBoard").val(),footerContent:$("#footerContent").val(),htmlHead:$("#htmlHead").val(),externalRelevantArticlesDisplayCount:$("#externalRelevantArticlesDisplayCount").val(),relevantArticlesDisplayCount:$("#relevantArticlesDisplayCount").val(),randomArticlesDisplayCount:$("#randomArticlesDisplayCount").val(),enableArticleUpdateHint:$("#enableArticleUpdateHint").prop("checked"),signs:e,allowVisitDraftViaPermalink:$("#allowVisitDraftViaPermalink").prop("checked"),articleListStyle:$("#articleListDisplay").val(),feedOutputMode:$("#feedOutputMode").val(),feedOutputCnt:$("#feedOutputCnt").val(),faviconURL:$("#faviconURL").val(),syncGitHub:$("#syncGitHub").prop("checked"),commentable:$("#commentable").prop("checked"),customVars:$("#customVars").val()}};$.ajax({url:Label.servePath+"/console/preference/",type:"PUT",cache:!1,data:JSON.stringify(t),success:function(e,t){$("#tipMsg").text(e.msg),e.sc&&$("#localeString").val()!==admin.preference.locale&&window.location.reload(),$("#loadMsg").text("")}})}}},admin.register.preference={obj:admin.preference,init:admin.preference.init,refresh:function(){admin.clearTip()}};
admin.pluginList={tablePagination:new TablePaginate("plugin"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},init:function(t){this.tablePagination.buildTable([{style:"padding-left: 12px;",text:Label.pluginNameLabel,index:"name",width:230},{style:"padding-left: 12px;",text:Label.statusLabel,index:"status",minWidth:80},{style:"padding-left: 12px;",text:Label.authorLabel,index:"author",width:200},{style:"padding-left: 12px;",text:Label.versionLabel,index:"version",width:120}]),this.tablePagination.initPagination(),$("#pluginSetting").dialog({width:700,height:180,modal:!0,hideFooter:!0}),this.getList(t)},getList:function(n){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var l=this;$.ajax({url:Label.servePath+"/console/plugins/"+n+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(t,e){if($("#tipMsg").text(t.msg),t.sc){admin.pluginList.pageInfo.currentPage=n;for(var a=t.plugins,i=0;i<a.length;i++)a[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.pluginList.changeStatus('"+a[i].oId+"', '"+a[i].status+"')\">","ENABLED"===a[i].status?(a[i].status=Label.enabledLabel,a[i].expendRow+=Label.disableLabel):(a[i].status=Label.disabledLabel,a[i].expendRow+=Label.enableLabel),a[i].expendRow+="</a> ","{}"!=a[i].setting&&(a[i].expendRow+="<a href='javascript:void(0)' onclick=\"admin.pluginList.toSetting('"+a[i].oId+"')\"> "+Label.settingLabel+" </a> ");l.tablePagination.updateTablePagination(t.plugins,n,t.pagination),$("#loadMsg").text("")}else $("#loadMsg").text("")}})},toSetting:function(t){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e={oId:t};$.ajax({url:Label.servePath+"/console/plugin/toSetting",type:"POST",cache:!1,data:JSON.stringify(e),success:function(t,e){$("#tipMsg").text(t.msg),$("#pluginSetting").html(t),$("#pluginSetting").dialog("open"),$("#loadMsg").text("")}})},changeStatus:function(t,e){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var a={oId:t,status:e="ENABLED"===e?"DISABLED":"ENABLED"};$.ajax({url:Label.servePath+"/console/plugin/status/",type:"PUT",cache:!1,data:JSON.stringify(a),success:function(t,e){$("#tipMsg").text(t.msg),t.sc?($("#loadMsg").text(""),window.location.reload()):$("#loadMsg").text("")}})}},admin.register["plugin-list"]={obj:admin.pluginList,init:admin.pluginList.init,refresh:function(){$("#loadMsg").text("")}}; admin.pluginList={tablePagination:new TablePaginate("plugin"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},init:function(t){this.tablePagination.buildTable([{style:"padding-left: 12px;",text:Label.pluginNameLabel,index:"name",width:230},{style:"padding-left: 12px;",text:Label.statusLabel,index:"status",minWidth:80},{style:"padding-left: 12px;",text:Label.authorLabel,index:"author",width:200},{style:"padding-left: 12px;",text:Label.versionLabel,index:"version",width:120}]),this.tablePagination.initPagination(),$("#pluginSetting").dialog({width:700,height:180,modal:!0,hideFooter:!0}),this.getList(t)},getList:function(n){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var l=this;$.ajax({url:Label.servePath+"/console/plugins/"+n+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(t,e){if($("#tipMsg").text(t.msg),t.sc){admin.pluginList.pageInfo.currentPage=n;for(var a=t.plugins,i=0;i<a.length;i++)a[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.pluginList.changeStatus('"+a[i].oId+"', '"+a[i].status+"')\">","ENABLED"===a[i].status?(a[i].status=Label.enabledLabel,a[i].expendRow+=Label.disableLabel):(a[i].status=Label.disabledLabel,a[i].expendRow+=Label.enableLabel),a[i].expendRow+="</a> ","{}"!=a[i].setting&&(a[i].expendRow+="<a href='javascript:void(0)' onclick=\"admin.pluginList.toSetting('"+a[i].oId+"')\"> "+Label.settingLabel+" </a> ");l.tablePagination.updateTablePagination(t.plugins,n,t.pagination),$("#loadMsg").text("")}else $("#loadMsg").text("")}})},toSetting:function(t){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e={oId:t};$.ajax({url:Label.servePath+"/console/plugin/toSetting",type:"POST",cache:!1,data:JSON.stringify(e),success:function(t,e){$("#tipMsg").text(t.msg),$("#pluginSetting").html(t),$("#pluginSetting").dialog("open"),$("#loadMsg").text("")}})},changeStatus:function(t,e){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var a={oId:t,status:e="ENABLED"===e?"DISABLED":"ENABLED"};$.ajax({url:Label.servePath+"/console/plugin/status/",type:"PUT",cache:!1,data:JSON.stringify(a),success:function(t,e){$("#tipMsg").text(t.msg),t.sc?($("#loadMsg").text(""),window.location.reload()):$("#loadMsg").text("")}})}},admin.register["plugin-list"]={obj:admin.pluginList,init:admin.pluginList.init,refresh:function(){$("#loadMsg").text("")}};
......
...@@ -179,7 +179,8 @@ var Util = { ...@@ -179,7 +179,8 @@ var Util = {
return return
} }
Util.addScript(Label.staticServePath + '/js/lib/vditor-1.1.10/index.min.js', 'vditorScript') Util.addScript(Label.staticServePath + '/js/lib/vditor-1.1.10/index.min.js',
'vditorScript')
Vditor.mermaidRender(document.body) Vditor.mermaidRender(document.body)
Vditor.mathRender(document.body) Vditor.mathRender(document.body)
...@@ -295,6 +296,16 @@ var Util = { ...@@ -295,6 +296,16 @@ var Util = {
Util.parseLanguage() Util.parseLanguage()
Util.initSW() Util.initSW()
Util.previewImg() Util.previewImg()
Util.initDebugInfo()
},
/**
* 调试区域文案
*/
initDebugInfo: function () {
console.log(
'%cSolo%c\n 🎸一款小而美的博客系统,专为程序员设计。' + Label.version + ' © ' +
(new Date).getFullYear(),
'font-size:96px;color:#3b3e43', 'font-size:12px;color:rgba(0,0,0,0.38);')
}, },
/** /**
* @description 注册 Service Work * @description 注册 Service Work
......
var Util={isArticlePage:function(e){var t=!0;return-1<e.indexOf(Label.servePath+"/tags/")&&(t=!1),-1<e.indexOf(Label.servePath+"/tags.html")&&(t=!1),-1<e.indexOf(Label.servePath+"/category/")&&(t=!1),-1<e.indexOf(Label.servePath+"/archives.html")&&(t=!1),-1<e.indexOf(Label.servePath+"/archives/")&&(t=!1),-1<e.indexOf(Label.servePath+"/links.html")&&(t=!1),e===Label.servePath&&(t=!1),/^[0-9]*$/.test(e.replace(Label.servePath+"/",""))&&(t=!1),t},initPjax:function(e){1===$("#pjax").length&&($.pjax({selector:"a",container:"#pjax",show:"",cache:!1,storage:!0,titleSuffix:"",filter:function(e){return e===Label.servePath+"/rss.xml"||-1<e.indexOf(Label.servePath+"/admin-index.do")||!(-1<e.indexOf(Label.servePath))},callback:function(){Util.parseMarkdown(),Util.parseLanguage(),e&&e()}}),NProgress.configure({showSpinner:!1}),$("#pjax").bind("pjax.start",function(){NProgress.start()}),$("#pjax").bind("pjax.end",function(){window.scroll(window.scrollX,0),NProgress.done()}))},previewImg:function(){$("body").on("click",".vditor-reset img",function(){window.open(this.src)})},addStyle:function(e,t){if(!document.getElementById(t)){var i=document.createElement("link");i.id=t,i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(i)}},parseLanguage:function(){0!==$(".vditor-reset pre > code").length&&(Util.addStyle("https://cdn.jsdelivr.net/npm/highlight.js@9.15.6/styles/"+Label.hljsStyle+".min.css","vditorHljsStyle"),Label.markedAvailable||("undefined"==typeof hljs?$.ajax({url:"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.15.6/build/highlight.min.js",dataType:"script",cache:!0,success:function(){hljs.initHighlighting.called=!1,hljs.initHighlighting()}}):(hljs.initHighlighting.called=!1,hljs.initHighlighting())))},parseMarkdown:function(){if(!window.Vditor){var e=new XMLHttpRequest;e.open("GET",Label.staticServePath+"/js/lib/vditor-1.1.10/index.min.js",!1),e.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),e.send("");var t=document.createElement("script");t.type="text/javascript",t.text=e.responseText,document.getElementsByTagName("head")[0].appendChild(t)}Vditor.mermaidRender(document.body),Vditor.mathRender(document.body),Vditor.codeRender(document.body,Label.langLabel)},killIE:function(e){var t=navigator.userAgent.split("MSIE")[1];t&&(e||(e=7),parseFloat(t.split(";"))<=e&&function(){if(""===Cookie.readCookie("showKill"))try{var t="<div style='display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110'></div><iframe style='left:"+($(window).width()-781)/2+"px;z-index:120;top: "+($(window).height()-680)/2+"px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='"+Label.servePath+"/kill-browser'></iframe>";$("body").append(t)}catch(e){t="<div style='display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110'></div><iframe style='left:10px;z-index:120;top: 0px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='"+Label.servePath+"/kill-browser'></iframe>",document.body.innerHTML=document.body.innerHTML+t}}())},replaceEmString:function(e){var t=e.split("[em");if(1===t.length)return e;e=t[0];for(var i=1;i<t.length;i++){var n=t[i].substr(0,2);e+="<img width='20' src='"+Label.staticServePath+"/images/emotions/em"+n+".png' alt='"+Label["em"+n+"Label"]+"' title='"+Label["em"+n+"Label"]+"'/> "+t[i].substr(3)}return e},switchMobile:function(e){Cookie.createCookie("btouch_switch_toggle",e,365),setTimeout(function(){location.reload()},1250)},setTopBar:function(){var e=$("#top");if(1===e.length){var t=$("#showTop");t.click(function(){e.slideDown(),t.hide()}),$("#hideTop").click(function(){e.slideUp(),t.show()})}},goTop:function(){$("html, body").animate({scrollTop:0},800)},goBottom:function(e){e||(e=0),$("html, body").animate({scrollTop:$(document).height()-$(window).height()-e},800)},init:function(){Util.killIE(),Util.parseMarkdown(),Util.parseLanguage(),Util.initSW(),Util.previewImg()},initSW:function(){navigator.serviceWorker&&navigator.serviceWorker.register("/sw.js",{scope:"/"})},replaceSideEm:function(e){for(var t=0;t<e.length;t++){var i=$(e[t]);i.html(Util.replaceEmString(i.html()))}},buildTags:function(e){e=e||"tags";for(var t=["tags1","tags2","tags3","tags4","tags5"],i=$("#"+e+" b").get(),n=parseInt($("#"+e+" b").last().text()),a=Math.ceil(n/t.length),o=0;o<i.length;o++)for(var r=parseInt(i[o].innerHTML),l=0;l<t.length;l++)if(l*a<r&&r<=(l+1)*a){i[o].parentNode.className=t[l];break}$("#"+e).html($("#"+e+" li").get().sort(function(e,t){var i=$(e).find("span").text().toLowerCase(),n=$(t).find("span").text().toLowerCase();return i.localeCompare(n)}))},toDate:function(e,t){var i=new Date(e),n={"M+":i.getMonth()+1,"d+":i.getDate(),"H+":i.getHours(),"m+":i.getMinutes(),"s+":i.getSeconds(),"q+":Math.floor((i.getMonth()+3)/3),S:i.getMilliseconds()};for(var a in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(i.getFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+a+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?n[a]:("00"+n[a]).substr((""+n[a]).length)));return t}};if(!Cookie)var Cookie={readCookie:function(e){for(var t=e+"=",i=document.cookie.split(";"),n=0;n<i.length;n++){for(var a=i[n];" "==a.charAt(0);)a=a.substring(1,a.length);if(0==a.indexOf(t))return decodeURIComponent(a.substring(t.length,a.length))}return""},eraseCookie:function(e){this.createCookie(e,"",-1)},createCookie:function(e,t,i){var n="";if(i){var a=new Date;a.setTime(a.getTime()+24*i*60*60*1e3),n="; expires="+a.toGMTString()}document.cookie=e+"="+encodeURIComponent(t)+n+"; path=/"}}; var Util={isArticlePage:function(e){var t=!0;return-1<e.indexOf(Label.servePath+"/tags/")&&(t=!1),-1<e.indexOf(Label.servePath+"/tags.html")&&(t=!1),-1<e.indexOf(Label.servePath+"/category/")&&(t=!1),-1<e.indexOf(Label.servePath+"/archives.html")&&(t=!1),-1<e.indexOf(Label.servePath+"/archives/")&&(t=!1),-1<e.indexOf(Label.servePath+"/links.html")&&(t=!1),e===Label.servePath&&(t=!1),/^[0-9]*$/.test(e.replace(Label.servePath+"/",""))&&(t=!1),t},initPjax:function(e){1===$("#pjax").length&&($.pjax({selector:"a",container:"#pjax",show:"",cache:!1,storage:!0,titleSuffix:"",filter:function(e){return e===Label.servePath+"/rss.xml"||-1<e.indexOf(Label.servePath+"/admin-index.do")||!(-1<e.indexOf(Label.servePath))},callback:function(){Util.parseMarkdown(),Util.parseLanguage(),e&&e()}}),NProgress.configure({showSpinner:!1}),$("#pjax").bind("pjax.start",function(){NProgress.start()}),$("#pjax").bind("pjax.end",function(){window.scroll(window.scrollX,0),NProgress.done()}))},previewImg:function(){$("body").on("click",".vditor-reset img",function(){$(this).hasClass("prevent")||window.open(this.src)})},addStyle:function(e,t){if(!document.getElementById(t)){var i=document.createElement("link");i.id=t,i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",e),document.getElementsByTagName("head")[0].appendChild(i)}},addScript:function(e,t){if(!document.getElementById(t)){var i=new XMLHttpRequest;i.open("GET",e,!1),i.setRequestHeader("Accept","text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"),i.send("");var n=document.createElement("script");n.id=t,n.type="text/javascript",n.text=i.responseText,document.getElementsByTagName("head")[0].appendChild(n)}},parseLanguage:function(){0!==$(".vditor-reset pre > code").length&&(Util.addStyle("https://cdn.jsdelivr.net/npm/highlight.js@9.15.6/styles/"+Label.hljsStyle+".min.css","vditorHljsStyle"),Label.markedAvailable||("undefined"==typeof hljs?$.ajax({url:"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.15.6/build/highlight.min.js",dataType:"script",cache:!0,success:function(){hljs.initHighlighting.called=!1,hljs.initHighlighting()}}):(hljs.initHighlighting.called=!1,hljs.initHighlighting())))},parseMarkdown:function(){var e=$(".vditor-reset").text();(0!==$(".vditor-reset pre > code").length||2<e.split("$").length||1<e.split("\\(").length&&1<e.split("\\)").length)&&(Util.addScript(Label.staticServePath+"/js/lib/vditor-1.1.10/index.min.js","vditorScript"),Vditor.mermaidRender(document.body),Vditor.mathRender(document.body),Vditor.codeRender(document.body,Label.langLabel))},killIE:function(e){var t=navigator.userAgent.split("MSIE")[1];t&&(e||(e=7),parseFloat(t.split(";"))<=e&&function(){if(""===Cookie.readCookie("showKill"))try{var t="<div style='display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110'></div><iframe style='left:"+($(window).width()-781)/2+"px;z-index:120;top: "+($(window).height()-680)/2+"px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='"+Label.servePath+"/kill-browser'></iframe>";$("body").append(t)}catch(e){t="<div style='display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6;filter: alpha(opacity=60); top: 0px;z-index:110'></div><iframe style='left:10px;z-index:120;top: 0px; position: fixed; border: 0px none; width: 781px; height: 680px;' src='"+Label.servePath+"/kill-browser'></iframe>",document.body.innerHTML=document.body.innerHTML+t}}())},replaceEmString:function(e){var t=e.split("[em");if(1===t.length)return e;e=t[0];for(var i=1;i<t.length;i++){var n=t[i].substr(0,2);e+="<img width='20' src='"+Label.staticServePath+"/images/emotions/em"+n+".png' alt='"+Label["em"+n+"Label"]+"' title='"+Label["em"+n+"Label"]+"'/> "+t[i].substr(3)}return e},switchMobile:function(e){Cookie.createCookie("btouch_switch_toggle",e,365),setTimeout(function(){location.reload()},1250)},setTopBar:function(){var e=$("#top");if(1===e.length){var t=$("#showTop");t.click(function(){e.slideDown(),t.hide()}),$("#hideTop").click(function(){e.slideUp(),t.show()})}},goTop:function(){$("html, body").animate({scrollTop:0},800)},goBottom:function(e){e||(e=0),$("html, body").animate({scrollTop:$(document).height()-$(window).height()-e},800)},init:function(){Util.killIE(),Util.parseMarkdown(),Util.parseLanguage(),Util.initSW(),Util.previewImg(),Util.initDebugInfo()},initDebugInfo:function(){console.log("%cSolo%c\n 🎸一款小而美的博客系统,专为程序员设计。"+Label.version+" © "+(new Date).getFullYear(),"font-size:96px;color:#3b3e43","font-size:12px;color:rgba(0,0,0,0.38);")},initSW:function(){navigator.serviceWorker&&navigator.serviceWorker.register("/sw.js",{scope:"/"})},replaceSideEm:function(e){for(var t=0;t<e.length;t++){var i=$(e[t]);i.html(Util.replaceEmString(i.html()))}},buildTags:function(e){e=e||"tags";for(var t=["tags1","tags2","tags3","tags4","tags5"],i=$("#"+e+" b").get(),n=parseInt($("#"+e+" b").last().text()),o=Math.ceil(n/t.length),a=0;a<i.length;a++)for(var r=parseInt(i[a].innerHTML),l=0;l<t.length;l++)if(l*o<r&&r<=(l+1)*o){i[a].parentNode.className=t[l];break}$("#"+e).html($("#"+e+" li").get().sort(function(e,t){var i=$(e).find("span").text().toLowerCase(),n=$(t).find("span").text().toLowerCase();return i.localeCompare(n)}))},toDate:function(e,t){var i=new Date(e),n={"M+":i.getMonth()+1,"d+":i.getDate(),"H+":i.getHours(),"m+":i.getMinutes(),"s+":i.getSeconds(),"q+":Math.floor((i.getMonth()+3)/3),S:i.getMilliseconds()};for(var o in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(i.getFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+o+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?n[o]:("00"+n[o]).substr((""+n[o]).length)));return t}};if(!Cookie)var Cookie={readCookie:function(e){for(var t=e+"=",i=document.cookie.split(";"),n=0;n<i.length;n++){for(var o=i[n];" "==o.charAt(0);)o=o.substring(1,o.length);if(0==o.indexOf(t))return decodeURIComponent(o.substring(t.length,o.length))}return""},eraseCookie:function(e){this.createCookie(e,"",-1)},createCookie:function(e,t,i){var n="";if(i){var o=new Date;o.setTime(o.getTime()+24*i*60*60*1e3),n="; expires="+o.toGMTString()}document.cookie=e+"="+encodeURIComponent(t)+n+"; path=/"}};
\ No newline at end of file \ No newline at end of file
var Page=function(e){this.currentCommentId="",this.tips=e};$.extend(Page.prototype,{replaceCommentsEm:function(e){for(var t=$(e),o=0;o<t.length;o++){var l=t[o].innerHTML;t[o].innerHTML=Util.replaceEmString(l)}},load:function(){var e=this;$("#comment").click(function(){e.toggleEditor()}).attr("readonly","readonly"),$("#soloEditorCancel").click(function(){e.toggleEditor()}),$("#soloEditorAdd").click(function(){e.submitComment()})},toggleEditor:function(e,t){var o=$("#soloEditor");if(0!==o.length){if("undefined"==typeof vditor){window.vditor=new Vditor("soloEditorComment",{placeholder:this.tips.commentContentCannotEmptyLabel,height:180,tab:"\t",hint:{emojiPath:Label.staticServePath+"/js/lib/emojify.js-1.1.0/images/basic"},esc:function(){$("#soloEditorCancel").click()},ctrlEnter:function(){$("#soloEditorAdd").click()},preview:{delay:500,show:!1,url:Label.servePath+"/console/markdown/2html",hljs:{enable:!0,style:Label.hljsStyle},parse:function(e){"none"!==e.style.display&&Util.parseLanguage()}},counter:500,resize:{enable:!0,position:"top",after:function(){$("body").css("padding-bottom",$("#soloEditor").outerHeight())}},lang:Label.langLabel,toolbar:["emoji","headings","bold","italic","strike","|","line","quote","|","list","ordered-list","check","|","code","inline-code","|","undo","redo","|","link","table","|","preview","fullscreen","info","help"]}),vditor.focus()}"0px"===$("body").css("padding-bottom")||e?($("#soloEditorError").text(""),o.css({bottom:"0",opacity:1}),$("body").css("padding-bottom","238px"),this.currentCommentId=e,$("#soloEditorReplyTarget").text(t?"@"+t:""),"undefined"!=typeof vditor&&vditor.focus()):(o.css({bottom:"-300px",opacity:0}),$("body").css("padding-bottom",0))}else location.href=Label.servePath+"/start"},loadRandomArticles:function(s){var c=this.tips.randomArticles1Label;$.ajax({url:Label.servePath+"/articles/random",type:"POST",success:function(e,t){var o=e.randomArticles;if(o&&0!==o.length){for(var l="",n=0;n<o.length;n++){var r=o[n],i=r.articleTitle;l+="<li><a rel='nofollow' title='"+i+"' href='"+Label.servePath+r.articlePermalink+"'>"+i+"</a></li>"}var a=(s||"<h4>"+c+"</h4>")+"<ul>"+l+"</ul>";$("#randomArticles").append(a)}else $("#randomArticles").remove()}})},loadRelevantArticles:function(e,s){$.ajax({url:Label.servePath+"/article/id/"+e+"/relevant/articles",type:"GET",success:function(e,t){var o=e.relevantArticles;if(o&&0!==o.length){for(var l="",n=0;n<o.length;n++){var r=o[n],i=r.articleTitle;l+="<li><a rel='nofollow' title='"+i+"' href='"+Label.servePath+r.articlePermalink+"'>"+i+"</a></li>"}var a=s+"<ul>"+l+"</ul>";$("#relevantArticles").append(a)}else $("#relevantArticles").remove()},error:function(){$("#relevantArticles").remove()}})},loadExternalRelevantArticles:function(e,s){var c=this.tips;try{$.ajax({url:"https://rhythm.b3log.org/get-articles-by-tags.do?tags="+e+"&blogHost="+c.blogHost+"&paginationPageSize="+c.externalRelevantArticlesDisplayCount,type:"GET",cache:!0,dataType:"jsonp",error:function(){$("#externalRelevantArticles").remove()},success:function(e,t){var o=e.articles;if(o&&0!==o.length){for(var l="",n=0;n<o.length;n++){var r=o[n],i=r.articleTitle;l+="<li><a rel='nofollow' title='"+i+"' target='_blank' href='"+r.articlePermalink+"'>"+i+"</a></li>"}var a=(s||"<h4>"+c.externalRelevantArticles1Label+"</h4>")+"<ul>"+l+"</ul>";$("#externalRelevantArticles").append(a)}else $("#externalRelevantArticles").remove()}})}catch(e){}},submitComment:function(){var t=this,e=this.tips,o="article";if(void 0===e.externalRelevantArticlesDisplayCount&&(o="page"),1<vditor.getValue().length&&vditor.getValue().length<500){$("#soloEditorAdd").attr("disabled","disabled");var l={oId:e.oId,commentContent:vditor.getValue()};this.currentCommentId&&(l.commentOriginalCommentId=this.currentCommentId),$.ajax({type:"POST",url:Label.servePath+"/"+o+"/comments",cache:!1,contentType:"application/json",data:JSON.stringify(l),success:function(e){$("#soloEditorAdd").removeAttr("disabled"),e.sc?(t.toggleEditor(),vditor.setValue(""),t.addCommentAjax(Util.replaceEmString(e.cmtTpl))):$("#soloEditorError").html(e.msg)}})}else $("#soloEditorError").text(t.tips.commentContentCannotEmptyLabel)},addReplyForm:function(e,t){this.currentCommentId=e,this.toggleEditor(e,t)},hideComment:function(e){$("#commentRef"+e).hide()},showComment:function(e,t,o,l){var n=parseInt($(e).position().top);if(l&&(n=parseInt($(e).parents(l).position().top)),0<$("#commentRef"+t).length)$("#commentRef"+t).show().css("top",n+o+"px");else{var r=$("#"+t).clone();r.addClass("comment-body-ref").attr("id","commentRef"+t),r.find("#replyForm").remove(),$("#comments").append(r),$("#commentRef"+t).css("top",n+o+"px")}},addCommentAjax:function(e){0<$("#comments").children().length?$($("#comments").children()[0]).before(e):$("#comments").html(e),Util.parseMarkdown(),Util.parseLanguage(),window.location.hash="#comments"}}); var Page=function(e){this.currentCommentId="",this.tips=e};$.extend(Page.prototype,{replaceCommentsEm:function(e){for(var t=$(e),o=0;o<t.length;o++){var l=t[o].innerHTML;t[o].innerHTML=Util.replaceEmString(l)}},load:function(){var e=this;$("#comment").click(function(){e.toggleEditor()}).attr("readonly","readonly"),$("#soloEditorCancel").click(function(){e.toggleEditor()}),$("#soloEditorAdd").click(function(){e.submitComment()})},toggleEditor:function(e,t){var o=$("#soloEditor");if(0!==o.length){if(!$("#soloEditorComment").hasClass("vditor")){Util.addScript(Label.staticServePath+"/js/lib/vditor-1.1.10/index.min.js","vditorScript"),window.vditor=new Vditor("soloEditorComment",{placeholder:this.tips.commentContentCannotEmptyLabel,height:180,tab:"\t",hint:{emojiPath:Label.staticServePath+"/js/lib/emojify.js-1.1.0/images/basic"},esc:function(){$("#soloEditorCancel").click()},ctrlEnter:function(){$("#soloEditorAdd").click()},preview:{delay:500,show:!1,url:Label.servePath+"/console/markdown/2html",hljs:{enable:!0,style:Label.hljsStyle},parse:function(e){"none"!==e.style.display&&Util.parseLanguage()}},counter:500,resize:{enable:!0,position:"top",after:function(){$("body").css("padding-bottom",$("#soloEditor").outerHeight())}},lang:Label.langLabel,toolbar:["emoji","headings","bold","italic","strike","|","line","quote","|","list","ordered-list","check","|","code","inline-code","|","undo","redo","|","link","table","|","preview","fullscreen","info","help"]}),vditor.focus()}"0px"===$("body").css("padding-bottom")||e?($("#soloEditorError").text(""),o.css({bottom:"0",opacity:1}),$("body").css("padding-bottom","238px"),this.currentCommentId=e,$("#soloEditorReplyTarget").text(t?"@"+t:""),"undefined"!=typeof vditor&&vditor.focus()):(o.css({bottom:"-300px",opacity:0}),$("body").css("padding-bottom",0))}else location.href=Label.servePath+"/start"},loadRandomArticles:function(s){var c=this.tips.randomArticles1Label;$.ajax({url:Label.servePath+"/articles/random",type:"POST",success:function(e,t){var o=e.randomArticles;if(o&&0!==o.length){for(var l="",r=0;r<o.length;r++){var i=o[r],n=i.articleTitle;l+="<li><a rel='nofollow' title='"+n+"' href='"+Label.servePath+i.articlePermalink+"'>"+n+"</a></li>"}var a=(s||"<h4>"+c+"</h4>")+"<ul>"+l+"</ul>";$("#randomArticles").append(a)}else $("#randomArticles").remove()}})},loadRelevantArticles:function(e,s){$.ajax({url:Label.servePath+"/article/id/"+e+"/relevant/articles",type:"GET",success:function(e,t){var o=e.relevantArticles;if(o&&0!==o.length){for(var l="",r=0;r<o.length;r++){var i=o[r],n=i.articleTitle;l+="<li><a rel='nofollow' title='"+n+"' href='"+Label.servePath+i.articlePermalink+"'>"+n+"</a></li>"}var a=s+"<ul>"+l+"</ul>";$("#relevantArticles").append(a)}else $("#relevantArticles").remove()},error:function(){$("#relevantArticles").remove()}})},loadExternalRelevantArticles:function(e,s){var c=this.tips;try{$.ajax({url:"https://rhythm.b3log.org/get-articles-by-tags.do?tags="+e+"&blogHost="+c.blogHost+"&paginationPageSize="+c.externalRelevantArticlesDisplayCount,type:"GET",cache:!0,dataType:"jsonp",error:function(){$("#externalRelevantArticles").remove()},success:function(e,t){var o=e.articles;if(o&&0!==o.length){for(var l="",r=0;r<o.length;r++){var i=o[r],n=i.articleTitle;l+="<li><a rel='nofollow' title='"+n+"' target='_blank' href='"+i.articlePermalink+"'>"+n+"</a></li>"}var a=(s||"<h4>"+c.externalRelevantArticles1Label+"</h4>")+"<ul>"+l+"</ul>";$("#externalRelevantArticles").append(a)}else $("#externalRelevantArticles").remove()}})}catch(e){}},submitComment:function(){var t=this,e=this.tips,o="article";if(void 0===e.externalRelevantArticlesDisplayCount&&(o="page"),1<vditor.getValue().length&&vditor.getValue().length<500){$("#soloEditorAdd").attr("disabled","disabled");var l={oId:e.oId,commentContent:vditor.getValue()};this.currentCommentId&&(l.commentOriginalCommentId=this.currentCommentId),$.ajax({type:"POST",url:Label.servePath+"/"+o+"/comments",cache:!1,contentType:"application/json",data:JSON.stringify(l),success:function(e){$("#soloEditorAdd").removeAttr("disabled"),e.sc?(t.toggleEditor(),vditor.setValue(""),t.addCommentAjax(Util.replaceEmString(e.cmtTpl))):$("#soloEditorError").html(e.msg)}})}else $("#soloEditorError").text(t.tips.commentContentCannotEmptyLabel)},addReplyForm:function(e,t){this.currentCommentId=e,this.toggleEditor(e,t)},hideComment:function(e){$("#commentRef"+e).hide()},showComment:function(e,t,o,l){var r=parseInt($(e).position().top);if(l&&(r=parseInt($(e).parents(l).position().top)),0<$("#commentRef"+t).length)$("#commentRef"+t).show().css("top",r+o+"px");else{var i=$("#"+t).clone();i.addClass("comment-body-ref").attr("id","commentRef"+t),i.find("#replyForm").remove(),$("#comments").append(i),$("#commentRef"+t).css("top",r+o+"px")}},addCommentAjax:function(e){0<$("#comments").children().length?$($("#comments").children()[0]).before(e):$("#comments").html(e),Util.parseMarkdown(),Util.parseLanguage(),window.location.hash="#comments"}});
\ No newline at end of file \ No newline at end of file
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-2019, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.b3log.solo.processor.console; package org.b3log.solo.processor.console;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment