Commit 1bcda310 authored by Liang Ding's avatar Liang Ding

Merge branch '3.2.0-dev' of https://github.com/b3log/solo into 3.2.0-dev

parents 281f76af 6236c7c7
...@@ -302,10 +302,9 @@ ...@@ -302,10 +302,9 @@
<includes> <includes>
<include>**/src/*/java/**/*.java</include> <include>**/src/*/java/**/*.java</include>
<include>**/src/*/webapp/js/*.js</include> <include>**/src/*/webapp/js/*.js</include>
<include>**/src/*/webapp/css/*.css</include>
<include>**/src/*/webapp/**/*.ftl</include> <include>**/src/*/webapp/**/*.ftl</include>
<include>**/src/*/webapp/skins/*/js/*.js</include> <include>**/src/*/webapp/skins/*/js/*.js</include>
<include>**/src/*/webapp/skins/*/css/*.css</include> <include>**/src/*/webapp/skins/*/css/*.scss</include>
<include>**/src/*/webapp/skins/**/*.properties</include> <include>**/src/*/webapp/skins/**/*.properties</include>
<include>**/src/*/webapp/plugins/*/js/*.js</include> <include>**/src/*/webapp/plugins/*/js/*.js</include>
<include>**/src/*/webapp/plugins/*/css/*.css</include> <include>**/src/*/webapp/plugins/*/css/*.css</include>
...@@ -319,6 +318,10 @@ ...@@ -319,6 +318,10 @@
<excludes> <excludes>
<exclude>**/src/main/java/**/package-info.java</exclude> <exclude>**/src/main/java/**/package-info.java</exclude>
<exclude>**/src/*/webapp/js/lib/*.js</exclude> <exclude>**/src/*/webapp/js/lib/*.js</exclude>
<include>**/src/*/webapp/js/*.min.js</include>
<include>**/src/*/webapp/js/admin/*.min.js</include>
<include>**/src/*/webapp/skins/*/js/*.min.js</include>
<include>**/src/*/webapp/skins/*/css/*.css</include>
<exclude>**/src/main/java/com/**/*.java</exclude> <exclude>**/src/main/java/com/**/*.java</exclude>
</excludes> </excludes>
......
...@@ -54,9 +54,7 @@ ...@@ -54,9 +54,7 @@
<include path="/js/**/*.woff"/> <include path="/js/**/*.woff"/>
<include path="/skins/**.css"/> <include path="/skins/**.css"/>
<include path="/skins/**.css.map"/>
<include path="/skins/**/*.css"/> <include path="/skins/**/*.css"/>
<include path="/skins/**/*.css.map"/>
<include path="/skins/**.js"/> <include path="/skins/**.js"/>
<include path="/skins/**/*.js"/> <include path="/skins/**/*.js"/>
<include path="/skins/**.png"/> <include path="/skins/**.png"/>
......
This diff is collapsed.
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.6.0.3, Feb 15, 2019 * @version 1.6.0.4, Mar 4, 2019
*/ */
admin.article = { admin.article = {
// 当发文章,取消发布,更新文章时设置为 false。不需在离开编辑器时进行提示。 // 当发文章,取消发布,更新文章时设置为 false。不需在离开编辑器时进行提示。
...@@ -28,7 +28,6 @@ admin.article = { ...@@ -28,7 +28,6 @@ admin.article = {
status: { status: {
id: undefined, id: undefined,
isArticle: undefined, isArticle: undefined,
articleHadBeenPublished: undefined,
}, },
content: '', content: '',
// 自动保存草稿定时器 // 自动保存草稿定时器
...@@ -65,7 +64,6 @@ admin.article = { ...@@ -65,7 +64,6 @@ admin.article = {
// set default value for article. // set default value for article.
$('#title').val(result.article.articleTitle) $('#title').val(result.article.articleTitle)
admin.article.status.articleHadBeenPublished = result.article.articleHadBeenPublished
admin.editors.articleEditor.setContent(result.article.articleContent) admin.editors.articleEditor.setContent(result.article.articleContent)
admin.editors.abstractEditor.setContent(result.article.articleAbstract) admin.editors.abstractEditor.setContent(result.article.articleAbstract)
admin.article.content = admin.editors.articleEditor.getContent() admin.article.content = admin.editors.articleEditor.getContent()
...@@ -134,10 +132,10 @@ admin.article = { ...@@ -134,10 +132,10 @@ admin.article = {
}, },
/** /**
* @@description 添加文章 * @@description 添加文章
* @param {Boolean} articleIsPublished 文章是否发布过 * @param {Boolean} articleStatus 0:已发布,1:草稿
* @param {Boolean} isAuto 是否为自动保存 * @param {Boolean} isAuto 是否为自动保存
*/ */
add: function (articleIsPublished, isAuto) { add: function (articleStatus, isAuto) {
if (admin.article.validate()) { if (admin.article.validate()) {
var that = this var that = this
that._addDisabled() that._addDisabled()
...@@ -156,7 +154,9 @@ admin.article = { ...@@ -156,7 +154,9 @@ admin.article = {
if ($('#articleThumbnail').prop('checked')) { if ($('#articleThumbnail').prop('checked')) {
var bgImage = $('.thumbnail__img').css('background-image') var bgImage = $('.thumbnail__img').css('background-image')
articleContent = '![](' + bgImage.substring(5, bgImage.length - 2).replace('w/768', 'w/960').replace('h/432', 'h/540') + articleContent = '![](' + bgImage.substring(5, bgImage.length - 2).
replace('w/768', 'w/960').
replace('h/432', 'h/540') +
')\n\n' + articleContent ')\n\n' + articleContent
} }
...@@ -167,7 +167,7 @@ admin.article = { ...@@ -167,7 +167,7 @@ admin.article = {
'articleAbstract': articleAbstract, 'articleAbstract': articleAbstract,
'articleTags': this.trimUniqueArray($('#tag').val()).toString(), 'articleTags': this.trimUniqueArray($('#tag').val()).toString(),
'articlePermalink': $('#permalink').val(), 'articlePermalink': $('#permalink').val(),
'articleIsPublished': articleIsPublished, 'articleStatus': articleStatus,
'articleSignId': signId, 'articleSignId': signId,
'postToCommunity': $('#postToCommunity').prop('checked'), 'postToCommunity': $('#postToCommunity').prop('checked'),
'articleCommentable': $('#articleCommentable').prop('checked'), 'articleCommentable': $('#articleCommentable').prop('checked'),
...@@ -192,7 +192,7 @@ admin.article = { ...@@ -192,7 +192,7 @@ admin.article = {
return return
} }
if (articleIsPublished) { if (articleStatus === 0) {
admin.article.status.id = undefined admin.article.status.id = undefined
admin.selectTab('article/article-list') admin.selectTab('article/article-list')
} else { } else {
...@@ -201,23 +201,19 @@ admin.article = { ...@@ -201,23 +201,19 @@ admin.article = {
admin.article.isConfirm = false admin.article.isConfirm = false
}, },
complete: function (jqXHR, textStatus) { complete: function () {
that._removeDisabled() that._removeDisabled()
$('#loadMsg').text('') $('#loadMsg').text('')
if (jqXHR.status === 403) {
$.get('/admin-index.do')
that.add(articleIsPublished)
}
}, },
}) })
} }
}, },
/** /**
* @description 更新文章 * @description 更新文章
* @param {Boolean} articleIsPublished 文章是否发布过 * @param {Boolean} articleStatus 0:已发布,1:草稿
* @param {Boolean} isAuto 是否为自动保存 * @param {Boolean} isAuto 是否为自动保存
*/ */
update: function (articleIsPublished, isAuto) { update: function (articleStatus, isAuto) {
if (admin.article.validate()) { if (admin.article.validate()) {
var that = this var that = this
that._addDisabled() that._addDisabled()
...@@ -235,7 +231,9 @@ admin.article = { ...@@ -235,7 +231,9 @@ admin.article = {
articleAbstract = admin.editors.abstractEditor.getContent() articleAbstract = admin.editors.abstractEditor.getContent()
if ($('#articleThumbnail').prop('checked')) { if ($('#articleThumbnail').prop('checked')) {
var bgImage = $('.thumbnail__img').css('background-image') var bgImage = $('.thumbnail__img').css('background-image')
articleContent = '![](' + bgImage.substring(5, bgImage.length - 2).replace('w/768', 'w/960').replace('h/432', 'h/540') + articleContent = '![](' + bgImage.substring(5, bgImage.length - 2).
replace('w/768', 'w/960').
replace('h/432', 'h/540') +
') \n\n' + articleContent ') \n\n' + articleContent
} }
var requestJSONObject = { var requestJSONObject = {
...@@ -246,7 +244,7 @@ admin.article = { ...@@ -246,7 +244,7 @@ admin.article = {
'articleAbstract': articleAbstract, 'articleAbstract': articleAbstract,
'articleTags': this.trimUniqueArray($('#tag').val()).toString(), 'articleTags': this.trimUniqueArray($('#tag').val()).toString(),
'articlePermalink': $('#permalink').val(), 'articlePermalink': $('#permalink').val(),
'articleIsPublished': articleIsPublished, 'articleStatus': articleStatus,
'articleSignId': signId, 'articleSignId': signId,
'articleCommentable': $('#articleCommentable').prop('checked'), 'articleCommentable': $('#articleCommentable').prop('checked'),
'articleViewPwd': $('#viewPwd').val(), 'articleViewPwd': $('#viewPwd').val(),
...@@ -270,7 +268,7 @@ admin.article = { ...@@ -270,7 +268,7 @@ admin.article = {
return return
} }
if (articleIsPublished) { if (articleStatus === 0) {
admin.selectTab('article/article-list') admin.selectTab('article/article-list')
} else { } else {
admin.selectTab('article/draft-list') admin.selectTab('article/draft-list')
...@@ -284,10 +282,6 @@ admin.article = { ...@@ -284,10 +282,6 @@ admin.article = {
complete: function (jqXHR, textStatus) { complete: function (jqXHR, textStatus) {
that._removeDisabled() that._removeDisabled()
$('#loadMsg').text('') $('#loadMsg').text('')
if (jqXHR.status === 403) {
$.get('/admin-index.do')
that.update(articleIsPublished)
}
}, },
}) })
} }
...@@ -348,7 +342,6 @@ admin.article = { ...@@ -348,7 +342,6 @@ admin.article = {
this.status = { this.status = {
id: undefined, id: undefined,
isArticle: undefined, isArticle: undefined,
articleHadBeenPublished: undefined,
} }
this.setStatus() this.setStatus()
...@@ -422,17 +415,17 @@ admin.article = { ...@@ -422,17 +415,17 @@ admin.article = {
// submit action // submit action
$('#submitArticle').click(function () { $('#submitArticle').click(function () {
if (admin.article.status.id) { if (admin.article.status.id) {
admin.article.update(true) admin.article.update(0)
} else { } else {
admin.article.add(true) admin.article.add(0)
} }
}) })
$('#saveArticle').click(function () { $('#saveArticle').click(function () {
if (admin.article.status.id) { if (admin.article.status.id) {
admin.article.update(admin.article.status.isArticle) admin.article.update(admin.article.status.isArticle ? 0 : 1)
} else { } else {
admin.article.add(false) admin.article.add(1)
} }
}) })
...@@ -442,14 +435,14 @@ admin.article = { ...@@ -442,14 +435,14 @@ admin.article = {
height: 500, height: 500,
fun: fun, fun: fun,
previewShow: true, previewShow: true,
resize: false resize: false,
}) })
admin.editors.abstractEditor = new SoloEditor({ admin.editors.abstractEditor = new SoloEditor({
id: 'abstract', id: 'abstract',
height: 200, height: 200,
previewShow: false, previewShow: false,
resize: true resize: true,
}) })
admin.article.clearDraftTimer() admin.article.clearDraftTimer()
...@@ -486,10 +479,10 @@ admin.article = { ...@@ -486,10 +479,10 @@ admin.article = {
} }
if (admin.article.status.id) { if (admin.article.status.id) {
if (!admin.article.status.isArticle) { if (!admin.article.status.isArticle) {
admin.article.update(false, true) admin.article.update(1, true)
} }
} else { } else {
admin.article.add(false, true) admin.article.add(1, true)
admin.article.status.isArticle = false admin.article.status.isArticle = false
} }
}, },
...@@ -548,10 +541,6 @@ admin.article = { ...@@ -548,10 +541,6 @@ admin.article = {
complete: function (jqXHR, textStatus) { complete: function (jqXHR, textStatus) {
that._removeDisabled() that._removeDisabled()
$('#loadMsg').text('') $('#loadMsg').text('')
if (jqXHR.status === 403) {
$.get('/admin-index.do')
that.unPublish()
}
}, },
}) })
}, },
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.6.0.0, Feb 21, 2019 * @version 1.7.0.0, Mar 4, 2019
*/ */
/** /**
...@@ -93,6 +93,14 @@ var Util = { ...@@ -93,6 +93,14 @@ var Util = {
}) })
} }
}, },
/**
* 图片预览
*/
previewImg:function () {
$('body').on('click', '.content-reset img', function () {
window.open(this.src);
});
},
/** /**
* 按需加载 MathJax 及 flow * 按需加载 MathJax 及 flow
* @returns {undefined} * @returns {undefined}
...@@ -286,6 +294,7 @@ var Util = { ...@@ -286,6 +294,7 @@ var Util = {
Util.setTopBar() Util.setTopBar()
Util.parseMarkdown() Util.parseMarkdown()
Util.initSW() Util.initSW()
Util.previewImg()
}, },
/** /**
* @description 注册 Service Work * @description 注册 Service Work
......
This diff is collapsed.
/*
* 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/>.
*/
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 i=t[o].innerHTML;t[o].innerHTML=Util.replaceEmString(i)}},parseLanguage:function(e){var t=!1;$(".content-reset pre").each(function(){t=!0}),t&&(document.createStyleSheet?document.createStyleSheet(latkeConfig.staticServePath+"/js/lib/highlight-9.13.1/styles/"+(e&&e.theme||"github")+".css"):$("head").append($("<link rel='stylesheet' href='"+latkeConfig.staticServePath+"/js/lib/highlight-9.13.1/styles/"+(e&&e.theme||"github")+".css'>")),Label.markedAvailable||$.ajax({url:latkeConfig.staticServePath+"/js/lib/highlight-9.13.1/highlight.pack.js",dataType:"script",cache:!0,success:function(){hljs.initHighlighting.called=!1,hljs.initHighlighting()}}))},load:function(e){var t=this;t.parseLanguage(e),$("#comment").click(function(){t.toggleEditor()}).attr("readonly","readonly"),$("#soloEditorCancel").click(function(){t.toggleEditor()}),$("#soloEditorAdd").click(function(){t.submitComment()})},toggleEditor:function(e,t){var o=this;"undefined"==typeof Vditor&&$.ajax({method:"GET",url:latkeConfig.staticServePath+"/js/lib/vditor-0.2.5/index.min.js",dataType:"script",cache:!0,async:!1,success:function(){window.vditor=new Vditor("soloEditorComment",{placeholder:o.tips.commentContentCannotEmptyLabel,height:180,hint:{emojiPath:latkeConfig.staticServePath+"/js/lib/emojify.js-1.1.0/images/basic"},esc:function(){$("#soloEditorCancel").click()},ctrlEnter:function(){$("#soloEditorAdd").click()},preview:{delay:500,show:!1,url:latkeConfig.servePath+"/console/markdown/2html",parse:function(e){"none"!==e.style.display&&(Util.parseMarkdown("content-reset"),Label.markedAvailable||(hljs.initHighlighting.called=!1,hljs.initHighlighting()))}},counter:500,resize:{enable:!0,position:"top",after:function(){$("body").css("padding-bottom",$("#soloEditor").outerHeight())}},lang:o.tips.langLabel,toolbar:["emoji","headings","bold","italic","strike","|","line","quote","|","list","ordered-list","check","|","code","inline-code","|","undo","redo","|","link","table","|","preview","fullscreen","info","help"],classes:{preview:"content__reset"}}),vditor.focus()}});var i=$("#soloEditor");0!==i.length?"0px"===$("body").css("padding-bottom")||e?($("#soloEditorError").text(""),i.css({bottom:"0",opacity:1}),$("body").css("padding-bottom","238px"),this.currentCommentId=e,$("#soloEditorReplyTarget").text(t?"@"+t:""),"undefined"!=typeof vditor&&vditor.focus()):(i.css({bottom:"-300px",opacity:0}),$("body").css("padding-bottom",0)):location.href=latkeConfig.servePath+"/start"},loadRandomArticles:function(s){var c=this.tips.randomArticles1Label;$.ajax({url:latkeConfig.servePath+"/articles/random",type:"POST",success:function(e,t){var o=e.randomArticles;if(o&&0!==o.length){for(var i="",n=0;n<o.length;n++){var l=o[n],a=l.articleTitle;i+="<li><a rel='nofollow' title='"+a+"' href='"+latkeConfig.servePath+l.articlePermalink+"'>"+a+"</a></li>"}var r=(s||"<h4>"+c+"</h4>")+"<ul>"+i+"</ul>";$("#randomArticles").append(r)}else $("#randomArticles").remove()}})},loadRelevantArticles:function(e,s){$.ajax({url:latkeConfig.servePath+"/article/id/"+e+"/relevant/articles",type:"GET",success:function(e,t){var o=e.relevantArticles;if(o&&0!==o.length){for(var i="",n=0;n<o.length;n++){var l=o[n],a=l.articleTitle;i+="<li><a rel='nofollow' title='"+a+"' href='"+latkeConfig.servePath+l.articlePermalink+"'>"+a+"</a></li>"}var r=s+"<ul>"+i+"</ul>";$("#relevantArticles").append(r)}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 i="",n=0;n<o.length;n++){var l=o[n],a=l.articleTitle;i+="<li><a rel='nofollow' title='"+a+"' target='_blank' href='"+l.articlePermalink+"'>"+a+"</a></li>"}var r=(s||"<h4>"+c.externalRelevantArticles1Label+"</h4>")+"<ul>"+i+"</ul>";$("#externalRelevantArticles").append(r)}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 i={oId:e.oId,commentContent:vditor.getValue()};this.currentCommentId&&(i.commentOriginalCommentId=this.currentCommentId),$.ajax({type:"POST",url:latkeConfig.servePath+"/"+o+"/comments",cache:!1,contentType:"application/json",data:JSON.stringify(i),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,i){var n=parseInt($(e).position().top);if(i&&(n=parseInt($(e).parents(i).position().top)),0<$("#commentRef"+t).length)$("#commentRef"+t).show().css("top",n+o+"px");else{var l=$("#"+t).clone();l.addClass("comment-body-ref").attr("id","commentRef"+t),l.find("#replyForm").remove(),$("#comments").append(l),$("#commentRef"+t).css("top",n+o+"px")}},addCommentAjax:function(e){0<$("#comments").children().length?$($("#comments").children()[0]).before(e):$("#comments").html(e),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 i=t[o].innerHTML;t[o].innerHTML=Util.replaceEmString(i)}},parseLanguage:function(e){var t=!1;$(".content-reset pre").each(function(){t=!0}),t&&(document.createStyleSheet?document.createStyleSheet(latkeConfig.staticServePath+"/js/lib/highlight-9.13.1/styles/"+(e&&e.theme||"github")+".css"):$("head").append($("<link rel='stylesheet' href='"+latkeConfig.staticServePath+"/js/lib/highlight-9.13.1/styles/"+(e&&e.theme||"github")+".css'>")),Label.markedAvailable||$.ajax({url:latkeConfig.staticServePath+"/js/lib/highlight-9.13.1/highlight.pack.js",dataType:"script",cache:!0,success:function(){hljs.initHighlighting.called=!1,hljs.initHighlighting()}}))},load:function(e){var t=this;t.parseLanguage(e),$("#comment").click(function(){t.toggleEditor()}).attr("readonly","readonly"),$("#soloEditorCancel").click(function(){t.toggleEditor()}),$("#soloEditorAdd").click(function(){t.submitComment()})},toggleEditor:function(e,t){var o=this;"undefined"==typeof Vditor&&$.ajax({method:"GET",url:latkeConfig.staticServePath+"/js/lib/vditor-0.2.5/index.min.js",dataType:"script",cache:!0,async:!1,success:function(){window.vditor=new Vditor("soloEditorComment",{placeholder:o.tips.commentContentCannotEmptyLabel,height:180,hint:{emojiPath:latkeConfig.staticServePath+"/js/lib/emojify.js-1.1.0/images/basic"},esc:function(){$("#soloEditorCancel").click()},ctrlEnter:function(){$("#soloEditorAdd").click()},preview:{delay:500,show:!1,url:latkeConfig.servePath+"/console/markdown/2html",parse:function(e){"none"!==e.style.display&&(Util.parseMarkdown("content-reset"),Label.markedAvailable||(hljs.initHighlighting.called=!1,hljs.initHighlighting()))}},counter:500,resize:{enable:!0,position:"top",after:function(){$("body").css("padding-bottom",$("#soloEditor").outerHeight())}},lang:o.tips.langLabel,toolbar:["emoji","headings","bold","italic","strike","|","line","quote","|","list","ordered-list","check","|","code","inline-code","|","undo","redo","|","link","table","|","preview","fullscreen","info","help"],classes:{preview:"content__reset"}}),vditor.focus()}});var i=$("#soloEditor");0!==i.length?"0px"===$("body").css("padding-bottom")||e?($("#soloEditorError").text(""),i.css({bottom:"0",opacity:1}),$("body").css("padding-bottom","238px"),this.currentCommentId=e,$("#soloEditorReplyTarget").text(t?"@"+t:""),"undefined"!=typeof vditor&&vditor.focus()):(i.css({bottom:"-300px",opacity:0}),$("body").css("padding-bottom",0)):location.href=latkeConfig.servePath+"/start"},loadRandomArticles:function(s){var c=this.tips.randomArticles1Label;$.ajax({url:latkeConfig.servePath+"/articles/random",type:"POST",success:function(e,t){var o=e.randomArticles;if(o&&0!==o.length){for(var i="",n=0;n<o.length;n++){var l=o[n],a=l.articleTitle;i+="<li><a rel='nofollow' title='"+a+"' href='"+latkeConfig.servePath+l.articlePermalink+"'>"+a+"</a></li>"}var r=(s||"<h4>"+c+"</h4>")+"<ul>"+i+"</ul>";$("#randomArticles").append(r)}else $("#randomArticles").remove()}})},loadRelevantArticles:function(e,s){$.ajax({url:latkeConfig.servePath+"/article/id/"+e+"/relevant/articles",type:"GET",success:function(e,t){var o=e.relevantArticles;if(o&&0!==o.length){for(var i="",n=0;n<o.length;n++){var l=o[n],a=l.articleTitle;i+="<li><a rel='nofollow' title='"+a+"' href='"+latkeConfig.servePath+l.articlePermalink+"'>"+a+"</a></li>"}var r=s+"<ul>"+i+"</ul>";$("#relevantArticles").append(r)}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 i="",n=0;n<o.length;n++){var l=o[n],a=l.articleTitle;i+="<li><a rel='nofollow' title='"+a+"' target='_blank' href='"+l.articlePermalink+"'>"+a+"</a></li>"}var r=(s||"<h4>"+c.externalRelevantArticles1Label+"</h4>")+"<ul>"+i+"</ul>";$("#externalRelevantArticles").append(r)}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 i={oId:e.oId,commentContent:vditor.getValue()};this.currentCommentId&&(i.commentOriginalCommentId=this.currentCommentId),$.ajax({type:"POST",url:latkeConfig.servePath+"/"+o+"/comments",cache:!1,contentType:"application/json",data:JSON.stringify(i),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,i){var n=parseInt($(e).position().top);if(i&&(n=parseInt($(e).parents(i).position().top)),0<$("#commentRef"+t).length)$("#commentRef"+t).show().css("top",n+o+"px");else{var l=$("#"+t).clone();l.addClass("comment-body-ref").attr("id","commentRef"+t),l.find("#replyForm").remove(),$("#comments").append(l),$("#commentRef"+t).css("top",n+o+"px")}},addCommentAjax:function(e){0<$("#comments").children().length?$($("#comments").children()[0]).before(e):$("#comments").html(e),window.location.hash="#comments"}});
\ No newline at end of file
Subproject commit 38f6da79d5253a455a1ba52959643ebf544e835c Subproject commit 0d85dfbfd153ee8e70ce17257c649ad3e2c064f4
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