Commit a0c79533 authored by Van's avatar Van

📦

parent caf5a86c
......@@ -19,11 +19,12 @@
-->
<script>
var Label = {
"servePath": "${servePath}",
"staticServePath": "${staticServePath}",
"markedAvailable": ${markedAvailable?c},
"hljsStyle": "atom-one-light",
"langLabel": "${langLabel}"
};
servePath: "${servePath}",
staticServePath: "${staticServePath}",
markedAvailable: ${markedAvailable?c},
hljsStyle: 'atom-one-light',
langLabel: "${langLabel}",
version: "${version}",
}
Util.init()
</script>
\ No newline at end of file
This diff is collapsed.
......@@ -179,7 +179,8 @@ var Util = {
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.mathRender(document.body)
......@@ -295,6 +296,16 @@ var Util = {
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);')
},
/**
* @description 注册 Service Work
......
This diff is collapsed.
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"}});
\ 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(!$("#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
/*
* 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;
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