Commit 0c8c43b2 authored by Van's avatar Van

🎨 #12720 #4

parent 5fdf2e59
...@@ -18,138 +18,86 @@ ...@@ -18,138 +18,86 @@
--> -->
<script type="text/javascript"> <script type="text/javascript">
var latkeConfig = { <#include "../common-template/label.ftl">
"staticServePath": "${staticServePath}", Label.pushSuccLabel = '${pushSuccLabel}',
"servePath": "${servePath}", Label.pushToHacpaiLabel = '${pushToHacpaiLabel}',
"isLoggedIn": "true" Label.uploadMsg = '${uploadMsg}',
}; Label.uploadToken = "${uploadToken}",
Label.uploadURL = "${uploadURL}",
var Label = { Label.skinDirName = "${skinDirName}",
"langLabel": "${langLabel}", Label.userRole = "${userRole}",
"hljsStyle": "atom-one-light", Label.PAGE_SIZE = "${articleListDisplayCount}",
"pushSuccLabel": '${pushSuccLabel}', Label.WINDOW_SIZE = "${articleListPaginationWindowSize}",
"pushToHacpaiLabel": '${pushToHacpaiLabel}', Label.localeString = "${localeString}",
"uploadMsg": '${uploadMsg}', Label.version = "${version}",
"uploadToken": "${uploadToken}", Label.reportIssueLabel = "please report this issue on https://github.com/b3log/solo/issues/new",
"uploadURL": "${uploadURL}", Label.noDataLabel = "${noDataLabel}",
"markedAvailable": ${markedAvailable?c}, Label.linkDescriptionLabel = "${linkDescriptionLabel}",
"skinDirName": "${skinDirName}", Label.addressInvalidLabel = "${addressInvalidLabel}",
"userRole": "${userRole}", Label.selectLabel = "${selectLabel}",
"PAGE_SIZE": "${articleListDisplayCount}", Label.outOfDateLabel = "${outOfDateLabel}",
"WINDOW_SIZE": "${articleListPaginationWindowSize}", Label.upToDateLabel = "${upToDateLabel}",
"localeString": "${localeString}", Label.commentContentLabel = "${commentContentLabel}",
"version": "${version}", Label.loadingLabel = "${loadingLabel}",
"miniPostfix": "${miniPostfix}", Label.noCommentLabel = "${noCommentLabel}",
"reportIssueLabel": "please report this issue on https://github.com/b3log/solo/issues/new", Label.confirmRemoveLabel = "${confirmRemoveLabel}",
"noDataLabel": "${noDataLabel}", Label.removeLabel = "${removeLabel}",
"linkDescriptionLabel": "${linkDescriptionLabel}", Label.cancelPutTopLabel = "${cancelPutTopLabel}",
"addressInvalidLabel": "${addressInvalidLabel}", Label.putTopLabel = "${putTopLabel}",
"selectLabel": "${selectLabel}", Label.viewLabel = "${viewLabel}",
"outOfDateLabel": "${outOfDateLabel}", Label.updateLabel = "${updateLabel}",
"upToDateLabel": "${upToDateLabel}", Label.commentLabel = "${commentLabel}",
"commentContentLabel": "${commentContentLabel}", Label.titleLabel = "${titleLabel}",
"loadingLabel": "${loadingLabel}", Label.authorLabel = "${authorLabel}",
"noCommentLabel": "${noCommentLabel}", Label.dateLabel = "${dateLabel}",
"confirmRemoveLabel": "${confirmRemoveLabel}", Label.pageLabel = "${pageLabel}",
"removeLabel": "${removeLabel}", Label.gotoLabel = "${gotoLabel}",
"cancelPutTopLabel": "${cancelPutTopLabel}", Label.permalinkLabel = "${permalinkLabel}",
"putTopLabel": "${putTopLabel}", Label.titleEmptyLabel = "${titleEmptyLabel}",
"viewLabel": "${viewLabel}", Label.contentEmptyLabel = "${contentEmptyLabel}",
"updateLabel": "${updateLabel}", Label.linkTitleLabel = "${linkTitleLabel}",
"commentLabel": "${commentLabel}", Label.urlLabel = "${urlLabel}",
"titleLabel": "${titleLabel}", Label.addressEmptyLabel = "${addressEmptyLabel}",
"tagsLabel": "${tagsLabel}", Label.pluginNameLabel = "${pluginNameLabel}",
"authorLabel": "${authorLabel}", Label.statusLabel = "${statusLabel}",
"createDateLabel": "${createDateLabel}", Label.versionLabel = "${versionLabel}",
"dateLabel": "${dateLabel}", Label.userNameLabel = "${userNameLabel}",
"previousPageLabel": "${previousPageLabel}", Label.roleLabel = "${roleLabel}",
"pageLabel": "${pageLabel}", Label.administratorLabel = "${administratorLabel}",
"nextPagePabel": "${nextPagePabel}", Label.categoryLabel = "${categoryLabel}",
"gotoLabel": "${gotoLabel}", Label.tagsEmptyLabel = "${tagsEmptyLabel}",
"fileNameLabel": "${fileNameLabel}", Label.commonUserLabel = "${commonUserLabel}",
"uploadDateLabel": "${uploadDateLabel}", Label.articleLabel = "${articleLabel}",
"sizeLabel": "${sizeLabel}", Label.enabledLabel = "${enabledLabel}",
"downloadCountLabel": "${downloadCountLabel}", Label.disabledLabel = "${disabledLabel}",
"downloadLabel": "${downloadLabel}", Label.editorLeaveLabel = "${editorLeaveLabel}",
"permalinkLabel": "${permalinkLabel}", Label.editorPostLabel = "${editorPostLabel}",
"titleEmptyLabel": "${titleEmptyLabel}", Label.enableLabel = "${enableLabel}",
"contentEmptyLabel": "${contentEmptyLabel}", Label.disableLabel = "${disableLabel}",
"linkTitleLabel": "${linkTitleLabel}", Label.settingLabel = "${settingLabel}",
"urlLabel": "${urlLabel}", Label.linkEmptyLabel = "${linkEmptyLabel}",
"addressEmptyLabel": "${addressEmptyLabel}", Label.openMethodLabel = "${openMethodLabel}",
"pluginNameLabel": "${pluginNameLabel}", Label.typeLabel = "${typeLabel}",
"statusLabel": "${statusLabel}", Label.notFoundLabel = "${notFoundLabel}",
"versionLabel": "${versionLabel}", Label.paramSettingsLabel = "${paramSettingsLabel}",
"userNameLabel": "${userNameLabel}", Label.nonNegativeIntegerOnlyLabel = "${nonNegativeIntegerOnlyLabel}",
"roleLabel": "${roleLabel}", Label.indexTagDisplayCntLabel = "${indexTagDisplayCntLabel}",
"administratorLabel": "${administratorLabel}", Label.indexRecentCommentDisplayCntLabel = "${indexRecentCommentDisplayCntLabel}",
"sumLabel": "${sumLabel}", Label.indexMostCommentArticleDisplayCntLabel = "${indexMostCommentArticleDisplayCntLabel}",
"countLabel": "${countLabel}", Label.indexMostViewArticleDisplayCntLabel = "${indexMostViewArticleDisplayCntLabel}",
"categoryLabel": "${categoryLabel}", Label.pageSizeLabel = "${pageSizeLabel}",
"tagsEmptyLabel": "${tagsEmptyLabel}", Label.windowSizeLabel = "${windowSizeLabel}",
"abstractEmptyLabel": "${abstractEmptyLabel}", Label.randomArticlesDisplayCntLabel = "${randomArticlesDisplayCntLabel}",
"commonUserLabel": "${commonUserLabel}", Label.relevantArticlesDisplayCntLabel = "${relevantArticlesDisplayCntLabel}",
"articleLabel": "${articleLabel}", Label.externalRelevantArticlesDisplayCntLabel = "${externalRelevantArticlesDisplayCntLabel}",
"enabledLabel": "${enabledLabel}", Label.nameTooLongLabel = "${nameTooLongLabel}",
"disabledLabel": "${disabledLabel}", Label.navLabel = "${navLabel}",
"signIsNullLabel": "${signIsNullLabel}", Label.userLabel = "${userLabel}",
"editorLeaveLabel": "${editorLeaveLabel}", Label.changeRoleLabel = "${changeRoleLabel}",
"editorPostLabel": "${editorPostLabel}", Label.visitorUserLabel = "${visitorUserLabel}",
"enableLabel": "${enableLabel}", Label.categoryTooLongLabel = "${categoryTooLongLabel}",
"disableLabel": "${disableLabel}", Label.descriptionLabel = "${descriptionLabel}",
"settingLabel": "${settingLabel}", Label.autoSaveLabel = "${autoSaveLabel}",
"linkEmptyLabel": "${linkEmptyLabel}", Label.previewLabel = '${previewLabel}',
"openMethodLabel": "${openMethodLabel}",
"typeLabel": "${typeLabel}",
"markdownHelpLabel": "${markdownHelpLabel}",
"notFoundLabel": "${notFoundLabel}",
"em00Label": "${em00Label}",
"em01Label": "${em01Label}",
"em02Label": "${em02Label}",
"em03Label": "${em03Label}",
"em04Label": "${em04Label}",
"em05Label": "${em05Label}",
"em06Label": "${em06Label}",
"em07Label": "${em07Label}",
"em08Label": "${em08Label}",
"em09Label": "${em09Label}",
"em10Label": "${em10Label}",
"em11Label": "${em11Label}",
"em12Label": "${em12Label}",
"em13Label": "${em13Label}",
"em14Label": "${em14Label}",
"paramSettingsLabel": "${paramSettingsLabel}",
"nonNegativeIntegerOnlyLabel": "${nonNegativeIntegerOnlyLabel}",
"indexTagDisplayCntLabel": "${indexTagDisplayCntLabel}",
"indexRecentCommentDisplayCntLabel": "${indexRecentCommentDisplayCntLabel}",
"indexMostCommentArticleDisplayCntLabel": "${indexMostCommentArticleDisplayCntLabel}",
"indexMostViewArticleDisplayCntLabel": "${indexMostViewArticleDisplayCntLabel}",
"pageSizeLabel": "${pageSizeLabel}",
"windowSizeLabel": "${windowSizeLabel}",
"randomArticlesDisplayCntLabel": "${randomArticlesDisplayCntLabel}",
"relevantArticlesDisplayCntLabel": "${relevantArticlesDisplayCntLabel}",
"externalRelevantArticlesDisplayCntLabel": "${externalRelevantArticlesDisplayCntLabel}",
"nameTooLongLabel": "${nameTooLongLabel}",
"navLabel": "${navLabel}",
"userLabel": "${userLabel}",
"changeRoleLabel": "${changeRoleLabel}",
"visitorUserLabel": "${visitorUserLabel}",
"categoryTooLongLabel": "${categoryTooLongLabel}",
"descriptionLabel": "${descriptionLabel}",
"autoSaveLabel": "${autoSaveLabel}",
"addBoldLabel": '${addBoldLabel}',
"addItalicLabel": '${addItalicLabel}',
"insertQuoteLabel": '${insertQuoteLabel}',
"addBulletedLabel": '${addBulletedLabel}',
"addNumberedListLabel": '${addNumberedListLabel}',
"addLinkLabel": '${addLinkLabel}',
"undoLabel": '${undoLabel}',
"redoLabel": '${redoLabel}',
"previewLabel": '${previewLabel}',
"helpLabel": '${helpLabel}',
"fullscreenLabel": '${fullscreenLabel}',
"uploadFilesLabel": '${uploadFilesLabel}'
};
admin.init(); admin.init();
</script> </script>
\ No newline at end of file
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/plugin/updateSetting", url: Label.servePath + "/console/plugin/updateSetting",
type: "POST", type: "POST",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
......
var latkeConfig = { <#--
"servePath": "${servePath}",
"staticServePath": "${staticServePath}", Solo - A small and beautiful blogging system written in Java.
"isLoggedIn": "${isLoggedIn?string}", Copyright (c) 2010-2019, b3log.org & hacpai.com
"userName": "${userName}"
}; 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 Label = { var Label = {
"servePath": "${servePath}",
"staticServePath": "${staticServePath}",
"markedAvailable": ${markedAvailable?c}, "markedAvailable": ${markedAvailable?c},
"hljsStyle": "atom-one-light", "hljsStyle": "atom-one-light",
"langLabel": "${langLabel}", "langLabel": "${langLabel}"
"skinDirName": "${skinDirName}"
}; };
...@@ -57,7 +57,7 @@ $.extend(Admin.prototype, { ...@@ -57,7 +57,7 @@ $.extend(Admin.prototype, {
* @description 登出 * @description 登出
*/ */
logout: function () { logout: function () {
window.location.href = latkeConfig.servePath + '/logout' window.location.href = Label.servePath + '/logout'
}, },
toggleMenu: function () { toggleMenu: function () {
if ($('#tabs').css('left') === '-240px') { if ($('#tabs').css('left') === '-240px') {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -51,7 +51,7 @@ admin.article = { ...@@ -51,7 +51,7 @@ admin.article = {
$('#loadMsg').text(Label.loadingLabel) $('#loadMsg').text(Label.loadingLabel)
$('#tipMsg').text('') $('#tipMsg').text('')
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/article/' + url: Label.servePath + '/console/article/' +
admin.article.status.id, admin.article.status.id,
type: 'GET', type: 'GET',
cache: false, cache: false,
...@@ -115,7 +115,7 @@ admin.article = { ...@@ -115,7 +115,7 @@ admin.article = {
$('#tipMsg').text('') $('#tipMsg').text('')
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/article/' + id, url: Label.servePath + '/console/article/' + id,
type: 'DELETE', type: 'DELETE',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -176,7 +176,7 @@ admin.article = { ...@@ -176,7 +176,7 @@ admin.article = {
} }
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/article/', url: Label.servePath + '/console/article/',
type: 'POST', type: 'POST',
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
...@@ -253,7 +253,7 @@ admin.article = { ...@@ -253,7 +253,7 @@ admin.article = {
} }
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/article/', url: Label.servePath + '/console/article/',
type: 'PUT', type: 'PUT',
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
...@@ -291,7 +291,7 @@ admin.article = { ...@@ -291,7 +291,7 @@ admin.article = {
*/ */
setStatus: function () { setStatus: function () {
$.ajax({// Gets all tags $.ajax({// Gets all tags
url: latkeConfig.servePath + '/console/tags', url: Label.servePath + '/console/tags',
type: 'GET', type: 'GET',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -383,7 +383,7 @@ admin.article = { ...@@ -383,7 +383,7 @@ admin.article = {
// For tag auto-completion // For tag auto-completion
$.ajax({// Gets all tags $.ajax({// Gets all tags
url: latkeConfig.servePath + '/console/tags', url: Label.servePath + '/console/tags',
type: 'GET', type: 'GET',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -453,7 +453,7 @@ admin.article = { ...@@ -453,7 +453,7 @@ admin.article = {
// thumbnail // thumbnail
$('#articleThumbnailBtn').click(function () { $('#articleThumbnailBtn').click(function () {
$.ajax({// Gets all tags $.ajax({// Gets all tags
url: latkeConfig.servePath + '/console/thumbs?n=1&w=768&h=432', url: Label.servePath + '/console/thumbs?n=1&w=768&h=432',
type: 'GET', type: 'GET',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -519,7 +519,7 @@ admin.article = { ...@@ -519,7 +519,7 @@ admin.article = {
var that = this var that = this
that._addDisabled() that._addDisabled()
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/article/unpublish/' + url: Label.servePath + '/console/article/unpublish/' +
admin.article.status.id, admin.article.status.id,
type: 'PUT', type: 'PUT',
cache: false, cache: false,
......
...@@ -74,7 +74,7 @@ admin.articleList = { ...@@ -74,7 +74,7 @@ admin.articleList = {
*/ */
syncToHacpai: function (id) { syncToHacpai: function (id) {
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/article/push2rhy?id=' + id, url: Label.servePath + '/console/article/push2rhy?id=' + id,
type: 'GET', type: 'GET',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -91,7 +91,7 @@ admin.articleList = { ...@@ -91,7 +91,7 @@ admin.articleList = {
var that = this var that = this
$('#loadMsg').text(Label.loadingLabel) $('#loadMsg').text(Label.loadingLabel)
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/articles/status/published/' + url: Label.servePath + '/console/articles/status/published/' +
pageNum + '/' + Label.PAGE_SIZE + '/' + Label.WINDOW_SIZE + '?k=' + pageNum + '/' + Label.PAGE_SIZE + '/' + Label.WINDOW_SIZE + '?k=' +
$('#articleListInput').val(), $('#articleListInput').val(),
type: 'GET', type: 'GET',
...@@ -107,7 +107,7 @@ admin.articleList = { ...@@ -107,7 +107,7 @@ admin.articleList = {
articleData = [] articleData = []
for (var i = 0; i < articles.length; i++) { for (var i = 0; i < articles.length; i++) {
articleData[i] = {} articleData[i] = {}
articleData[i].title = '<a href="' + latkeConfig.servePath + articleData[i].title = '<a href="' + Label.servePath +
articles[i].articlePermalink + '" target=\'_blank\' title=\'' + articles[i].articlePermalink + '" target=\'_blank\' title=\'' +
articles[i].articleTitle + '\' class=\'no-underline\'>' articles[i].articleTitle + '\' class=\'no-underline\'>'
+ articles[i].articleTitle + '</a><span class=\'table-tag\'>' + + articles[i].articleTitle + '</a><span class=\'table-tag\'>' +
...@@ -163,7 +163,7 @@ admin.articleList = { ...@@ -163,7 +163,7 @@ admin.articleList = {
} }
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/article/' + ajaxUrl + '/' + id, url: Label.servePath + '/console/article/' + ajaxUrl + '/' + id,
type: 'PUT', type: 'PUT',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
......
...@@ -70,7 +70,7 @@ admin.categoryList = { ...@@ -70,7 +70,7 @@ admin.categoryList = {
// For tag auto-completion // For tag auto-completion
$.ajax({// Gets all tags $.ajax({// Gets all tags
url: latkeConfig.servePath + "/console/tags", url: Label.servePath + "/console/tags",
type: "GET", type: "GET",
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -110,7 +110,7 @@ admin.categoryList = { ...@@ -110,7 +110,7 @@ admin.categoryList = {
var that = this; var that = this;
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/categories/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE, url: Label.servePath + "/console/categories/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE,
type: "GET", type: "GET",
cache: false, cache: false,
success: function(result, textStatus) { success: function(result, textStatus) {
...@@ -177,7 +177,7 @@ admin.categoryList = { ...@@ -177,7 +177,7 @@ admin.categoryList = {
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/category/", url: Label.servePath + "/console/category/",
type: "POST", type: "POST",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
...@@ -218,7 +218,7 @@ admin.categoryList = { ...@@ -218,7 +218,7 @@ admin.categoryList = {
$("#categoryUpdate").dialog("open"); $("#categoryUpdate").dialog("open");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/category/" + id, url: Label.servePath + "/console/category/" + id,
type: "GET", type: "GET",
cache: false, cache: false,
success: function(result, textStatus) { success: function(result, textStatus) {
...@@ -254,7 +254,7 @@ admin.categoryList = { ...@@ -254,7 +254,7 @@ admin.categoryList = {
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/category/", url: Label.servePath + "/console/category/",
type: "PUT", type: "PUT",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
...@@ -285,7 +285,7 @@ admin.categoryList = { ...@@ -285,7 +285,7 @@ admin.categoryList = {
$("#tipMsg").text(""); $("#tipMsg").text("");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/category/" + id, url: Label.servePath + "/console/category/" + id,
type: "DELETE", type: "DELETE",
cache: false, cache: false,
success: function(result, textStatus) { success: function(result, textStatus) {
...@@ -345,7 +345,7 @@ admin.categoryList = { ...@@ -345,7 +345,7 @@ admin.categoryList = {
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/category/order/", url: Label.servePath + "/console/category/order/",
type: "PUT", type: "PUT",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
......
...@@ -51,7 +51,7 @@ admin.comment = { ...@@ -51,7 +51,7 @@ admin.comment = {
} }
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/comments/' + from + '/' + onId, url: Label.servePath + '/console/comments/' + from + '/' + onId,
type: 'GET', type: 'GET',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -117,7 +117,7 @@ admin.comment = { ...@@ -117,7 +117,7 @@ admin.comment = {
} }
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/' + from + '/comment/' + id, url: Label.servePath + '/console/' + from + '/comment/' + id,
type: 'DELETE', type: 'DELETE',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
......
...@@ -64,7 +64,7 @@ admin.commentList = { ...@@ -64,7 +64,7 @@ admin.commentList = {
$('#loadMsg').text(Label.loadingLabel) $('#loadMsg').text(Label.loadingLabel)
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/comments/' + pageNum + '/' + url: Label.servePath + '/console/comments/' + pageNum + '/' +
Label.PAGE_SIZE + '/' + Label.WINDOW_SIZE, Label.PAGE_SIZE + '/' + Label.WINDOW_SIZE,
type: 'GET', type: 'GET',
cache: false, cache: false,
...@@ -89,7 +89,7 @@ admin.commentList = { ...@@ -89,7 +89,7 @@ admin.commentList = {
commentsData[i].content = '<div class="vditor-reset">' + commentsData[i].content = '<div class="vditor-reset">' +
Util.replaceEmString(comments[i].commentContent) + Util.replaceEmString(comments[i].commentContent) +
'</div><span class=\'table-tag\'> on &nbsp;&nbsp;</span><a href=\'' + '</div><span class=\'table-tag\'> on &nbsp;&nbsp;</span><a href=\'' +
latkeConfig.servePath + comments[i].commentSharpURL + Label.servePath + comments[i].commentSharpURL +
'\' target=\'_blank\'>' + comments[i].commentTitle + '\' target=\'_blank\'>' + comments[i].commentTitle +
'</a>' '</a>'
...@@ -132,7 +132,7 @@ admin.commentList = { ...@@ -132,7 +132,7 @@ admin.commentList = {
$('#loadMsg').text(Label.loadingLabel) $('#loadMsg').text(Label.loadingLabel)
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/' + type.toLowerCase() + url: Label.servePath + '/console/' + type.toLowerCase() +
'/comment/' + id, '/comment/' + id,
type: 'DELETE', type: 'DELETE',
cache: false, cache: false,
......
...@@ -71,7 +71,7 @@ admin.draftList = { ...@@ -71,7 +71,7 @@ admin.draftList = {
var that = this; var that = this;
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/articles/status/unpublished/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE, url: Label.servePath + "/console/articles/status/unpublished/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE,
type: "GET", type: "GET",
cache: false, cache: false,
success: function(result, textStatus){ success: function(result, textStatus){
...@@ -90,7 +90,7 @@ admin.draftList = { ...@@ -90,7 +90,7 @@ admin.draftList = {
articleData[i].comments = articles[i].articleCommentCount; articleData[i].comments = articles[i].articleCommentCount;
articleData[i].articleViewCount = articles[i].articleViewCount; articleData[i].articleViewCount = articles[i].articleViewCount;
articleData[i].author = articles[i].authorName; articleData[i].author = articles[i].authorName;
articleData[i].title = "<a class='no-underline' href='" + latkeConfig.servePath + articleData[i].title = "<a class='no-underline' href='" + Label.servePath +
articles[i].articlePermalink + "' target='_blank'>" + articles[i].articlePermalink + "' target='_blank'>" +
articles[i].articleTitle + "</a><span class='table-tag'>" + articles[i].articleTags + "</span>"; articles[i].articleTitle + "</a><span class='table-tag'>" + articles[i].articleTags + "</span>";
articleData[i].expendRow = "<a href='javascript:void(0)' onclick=\"admin.article.get('" + articles[i].oId + "', false);\">" + Label.updateLabel + "</a> \ articleData[i].expendRow = "<a href='javascript:void(0)' onclick=\"admin.article.get('" + articles[i].oId + "', false);\">" + Label.updateLabel + "</a> \
......
...@@ -45,12 +45,12 @@ $.extend(SoloEditor.prototype, { ...@@ -45,12 +45,12 @@ $.extend(SoloEditor.prototype, {
cache: true, cache: true,
tab: '\t', tab: '\t',
hint: { hint: {
emojiPath: latkeConfig.staticServePath + '/js/lib/emojify.js-1.1.0/images/basic' emojiPath: Label.staticServePath + '/js/lib/emojify.js-1.1.0/images/basic'
}, },
preview: { preview: {
delay: 500, delay: 500,
show: this.conf.previewShow, show: this.conf.previewShow,
url: latkeConfig.servePath + '/console/markdown/2html', url: Label.servePath + '/console/markdown/2html',
parse: function(element) { parse: function(element) {
if (element.style.display === 'none') { if (element.style.display === 'none') {
return return
......
...@@ -83,7 +83,7 @@ admin.linkList = { ...@@ -83,7 +83,7 @@ admin.linkList = {
var that = this; var that = this;
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/links/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE, url: Label.servePath + "/console/links/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE,
type: "GET", type: "GET",
cache: false, cache: false,
success: function(result, textStatus){ success: function(result, textStatus){
...@@ -151,7 +151,7 @@ admin.linkList = { ...@@ -151,7 +151,7 @@ admin.linkList = {
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/link/", url: Label.servePath + "/console/link/",
type: "POST", type: "POST",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
...@@ -191,7 +191,7 @@ admin.linkList = { ...@@ -191,7 +191,7 @@ admin.linkList = {
$("#updateLink").dialog("open"); $("#updateLink").dialog("open");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/link/" + id, url: Label.servePath + "/console/link/" + id,
type: "GET", type: "GET",
cache: false, cache: false,
success: function(result, textStatus){ success: function(result, textStatus){
...@@ -229,7 +229,7 @@ admin.linkList = { ...@@ -229,7 +229,7 @@ admin.linkList = {
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/link/", url: Label.servePath + "/console/link/",
type: "PUT", type: "PUT",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
...@@ -261,7 +261,7 @@ admin.linkList = { ...@@ -261,7 +261,7 @@ admin.linkList = {
$("#tipMsg").text(""); $("#tipMsg").text("");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/link/" + id, url: Label.servePath + "/console/link/" + id,
type: "DELETE", type: "DELETE",
cache: false, cache: false,
success: function(result, textStatus){ success: function(result, textStatus){
...@@ -327,7 +327,7 @@ admin.linkList = { ...@@ -327,7 +327,7 @@ admin.linkList = {
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/link/order/", url: Label.servePath + "/console/link/order/",
type: "PUT", type: "PUT",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
......
...@@ -39,7 +39,7 @@ admin.others = { ...@@ -39,7 +39,7 @@ admin.others = {
$("#tipMsg").text(""); $("#tipMsg").text("");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/tag/unused", url: Label.servePath + "/console/tag/unused",
type: "DELETE", type: "DELETE",
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -54,14 +54,14 @@ admin.others = { ...@@ -54,14 +54,14 @@ admin.others = {
$("#tipMsg").text(""); $("#tipMsg").text("");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/export/sql", url: Label.servePath + "/console/export/sql",
type: "GET", type: "GET",
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
// AJAX 下载文件的话这里会发两次请求,用 sc 来判断是否是文件,如果没有 sc 说明文件可以下载(实际上就是 result) // AJAX 下载文件的话这里会发两次请求,用 sc 来判断是否是文件,如果没有 sc 说明文件可以下载(实际上就是 result)
if (!result.sc) { if (!result.sc) {
// 再发一次请求进行正式下载 // 再发一次请求进行正式下载
window.location = latkeConfig.servePath + "/console/export/sql"; window.location = Label.servePath + "/console/export/sql";
} else { } else {
$("#tipMsg").text(result.msg); $("#tipMsg").text(result.msg);
} }
...@@ -75,14 +75,14 @@ admin.others = { ...@@ -75,14 +75,14 @@ admin.others = {
$("#tipMsg").text(""); $("#tipMsg").text("");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/export/json", url: Label.servePath + "/console/export/json",
type: "GET", type: "GET",
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
// AJAX 下载文件的话这里会发两次请求,用 sc 来判断是否是文件,如果没有 sc 说明文件可以下载(实际上就是 result) // AJAX 下载文件的话这里会发两次请求,用 sc 来判断是否是文件,如果没有 sc 说明文件可以下载(实际上就是 result)
if (!result.sc) { if (!result.sc) {
// 再发一次请求进行正式下载 // 再发一次请求进行正式下载
window.location = latkeConfig.servePath + "/console/export/json"; window.location = Label.servePath + "/console/export/json";
} else { } else {
$("#tipMsg").text(result.msg); $("#tipMsg").text(result.msg);
} }
...@@ -96,14 +96,14 @@ admin.others = { ...@@ -96,14 +96,14 @@ admin.others = {
$("#tipMsg").text(""); $("#tipMsg").text("");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/export/hexo", url: Label.servePath + "/console/export/hexo",
type: "GET", type: "GET",
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
// AJAX 下载文件的话这里会发两次请求,用 sc 来判断是否是文件,如果没有 sc 说明文件可以下载(实际上就是 result) // AJAX 下载文件的话这里会发两次请求,用 sc 来判断是否是文件,如果没有 sc 说明文件可以下载(实际上就是 result)
if (!result.sc) { if (!result.sc) {
// 再发一次请求进行正式下载 // 再发一次请求进行正式下载
window.location = latkeConfig.servePath + "/console/export/hexo"; window.location = Label.servePath + "/console/export/hexo";
} else { } else {
$("#tipMsg").text(result.msg); $("#tipMsg").text(result.msg);
} }
...@@ -116,7 +116,7 @@ admin.others = { ...@@ -116,7 +116,7 @@ admin.others = {
*/ */
getUnusedTags: function () { getUnusedTags: function () {
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/tag/unused", url: Label.servePath + "/console/tag/unused",
type: "GET", type: "GET",
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
......
...@@ -105,7 +105,7 @@ admin.pageList = { ...@@ -105,7 +105,7 @@ admin.pageList = {
var that = this; var that = this;
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/pages/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE, url: Label.servePath + "/console/pages/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE,
type: "GET", type: "GET",
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -172,7 +172,7 @@ admin.pageList = { ...@@ -172,7 +172,7 @@ admin.pageList = {
$("#tipMsg").text(""); $("#tipMsg").text("");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/page/" + id, url: Label.servePath + "/console/page/" + id,
type: "GET", type: "GET",
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -213,7 +213,7 @@ admin.pageList = { ...@@ -213,7 +213,7 @@ admin.pageList = {
$("#tipMsg").text(""); $("#tipMsg").text("");
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/page/" + id, url: Label.servePath + "/console/page/" + id,
type: "DELETE", type: "DELETE",
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -269,7 +269,7 @@ admin.pageList = { ...@@ -269,7 +269,7 @@ admin.pageList = {
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/page/", url: Label.servePath + "/console/page/",
type: "POST", type: "POST",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
...@@ -336,7 +336,7 @@ admin.pageList = { ...@@ -336,7 +336,7 @@ admin.pageList = {
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/page/", url: Label.servePath + "/console/page/",
type: "PUT", type: "PUT",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
...@@ -402,7 +402,7 @@ admin.pageList = { ...@@ -402,7 +402,7 @@ admin.pageList = {
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/page/order/", url: Label.servePath + "/console/page/order/",
type: "PUT", type: "PUT",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
......
...@@ -76,7 +76,7 @@ admin.pluginList = { ...@@ -76,7 +76,7 @@ admin.pluginList = {
var that = this; var that = this;
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/plugins/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE, url: Label.servePath + "/console/plugins/" + pageNum + "/" + Label.PAGE_SIZE + "/" + Label.WINDOW_SIZE,
type: "GET", type: "GET",
cache: false, cache: false,
success: function(result, textStatus) { success: function(result, textStatus) {
...@@ -119,7 +119,7 @@ admin.pluginList = { ...@@ -119,7 +119,7 @@ admin.pluginList = {
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/plugin/toSetting", url: Label.servePath + "/console/plugin/toSetting",
type: "POST", type: "POST",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
...@@ -148,7 +148,7 @@ admin.pluginList = { ...@@ -148,7 +148,7 @@ admin.pluginList = {
}; };
$.ajax({ $.ajax({
url: latkeConfig.servePath + "/console/plugin/status/", url: Label.servePath + "/console/plugin/status/",
type: "PUT", type: "PUT",
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
......
...@@ -33,7 +33,7 @@ admin.preference = { ...@@ -33,7 +33,7 @@ admin.preference = {
$('#tabPreference').tabs() $('#tabPreference').tabs()
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/preference/', url: Label.servePath + '/console/preference/',
type: 'GET', type: 'GET',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -95,10 +95,10 @@ admin.preference = { ...@@ -95,10 +95,10 @@ admin.preference = {
'"><div class="ft__center">' + '"><div class="ft__center">' +
skins[i].skinName skins[i].skinName
+ '</div><img class="skinPreview" src="' + '</div><img class="skinPreview" src="'
+ latkeConfig.staticServePath + '/skins/' + skins[i].skinDirName + Label.staticServePath + '/skins/' + skins[i].skinDirName
+ '/preview.png"/><div><button class="update small" data-name="' + + '/preview.png"/><div><button class="update small" data-name="' +
skins[i].skinDirName + '">' + Label.enableLabel + skins[i].skinDirName + '">' + Label.enableLabel +
'</button><button class="small" onclick="window.open(\'' + latkeConfig.servePath + '</button><button class="small" onclick="window.open(\'' + Label.servePath +
'?skin=' + skins[i].skinName + '\')">' '?skin=' + skins[i].skinName + '\')">'
+ Label.previewLabel + '</button></div></div>' + Label.previewLabel + '</button></div></div>'
} }
...@@ -261,7 +261,7 @@ admin.preference = { ...@@ -261,7 +261,7 @@ admin.preference = {
} }
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/preference/', url: Label.servePath + '/console/preference/',
type: 'PUT', type: 'PUT',
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
......
...@@ -73,7 +73,7 @@ admin.userList = { ...@@ -73,7 +73,7 @@ admin.userList = {
var that = this var that = this
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/users/' + pageNum + '/' + url: Label.servePath + '/console/users/' + pageNum + '/' +
Label.PAGE_SIZE + '/' + Label.WINDOW_SIZE, Label.PAGE_SIZE + '/' + Label.WINDOW_SIZE,
type: 'GET', type: 'GET',
cache: false, cache: false,
...@@ -138,7 +138,7 @@ admin.userList = { ...@@ -138,7 +138,7 @@ admin.userList = {
$('#userUpdate').dialog('open') $('#userUpdate').dialog('open')
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/user/' + id, url: Label.servePath + '/console/user/' + id,
type: 'GET', type: 'GET',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -179,7 +179,7 @@ admin.userList = { ...@@ -179,7 +179,7 @@ admin.userList = {
} }
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/user/', url: Label.servePath + '/console/user/',
type: 'PUT', type: 'PUT',
cache: false, cache: false,
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
...@@ -211,7 +211,7 @@ admin.userList = { ...@@ -211,7 +211,7 @@ admin.userList = {
$('#tipMsg').text('') $('#tipMsg').text('')
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/user/' + id, url: Label.servePath + '/console/user/' + id,
type: 'DELETE', type: 'DELETE',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
...@@ -247,7 +247,7 @@ admin.userList = { ...@@ -247,7 +247,7 @@ admin.userList = {
changeRole: function (id) { changeRole: function (id) {
$('#tipMsg').text('') $('#tipMsg').text('')
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/console/changeRole/' + id, url: Label.servePath + '/console/changeRole/' + id,
type: 'GET', type: 'GET',
cache: false, cache: false,
success: function (result, textStatus) { success: function (result, textStatus) {
......
...@@ -30,28 +30,28 @@ ...@@ -30,28 +30,28 @@
var Util = { var Util = {
isArticlePage: function (href) { isArticlePage: function (href) {
var isArticle = true var isArticle = true
if (href.indexOf(latkeConfig.servePath + '/tags/') > -1) { if (href.indexOf(Label.servePath + '/tags/') > -1) {
isArticle = false isArticle = false
} }
if (href.indexOf(latkeConfig.servePath + '/tags.html') > -1) { if (href.indexOf(Label.servePath + '/tags.html') > -1) {
isArticle = false isArticle = false
} }
if (href.indexOf(latkeConfig.servePath + '/category/') > -1) { if (href.indexOf(Label.servePath + '/category/') > -1) {
isArticle = false isArticle = false
} }
if (href.indexOf(latkeConfig.servePath + '/archives.html') > -1) { if (href.indexOf(Label.servePath + '/archives.html') > -1) {
isArticle = false isArticle = false
} }
if (href.indexOf(latkeConfig.servePath + '/archives/') > -1) { if (href.indexOf(Label.servePath + '/archives/') > -1) {
isArticle = false isArticle = false
} }
if (href.indexOf(latkeConfig.servePath + '/links.html') > -1) { if (href.indexOf(Label.servePath + '/links.html') > -1) {
isArticle = false isArticle = false
} }
if (href === latkeConfig.servePath) { if (href === Label.servePath) {
isArticle = false isArticle = false
} }
if (/^[0-9]*$/.test(href.replace(latkeConfig.servePath + '/', ''))) { if (/^[0-9]*$/.test(href.replace(Label.servePath + '/', ''))) {
isArticle = false isArticle = false
} }
return isArticle return isArticle
...@@ -70,11 +70,11 @@ var Util = { ...@@ -70,11 +70,11 @@ var Util = {
storage: true, storage: true,
titleSuffix: '', titleSuffix: '',
filter: function (href) { filter: function (href) {
if (href === latkeConfig.servePath + '/rss.xml' || if (href === Label.servePath + '/rss.xml' ||
href.indexOf(latkeConfig.servePath + '/admin-index.do') > -1) { href.indexOf(Label.servePath + '/admin-index.do') > -1) {
return true return true
} }
if (href.indexOf(latkeConfig.servePath) > -1) { if (href.indexOf(Label.servePath) > -1) {
return false return false
} }
return true return true
...@@ -144,7 +144,7 @@ var Util = { ...@@ -144,7 +144,7 @@ var Util = {
parseMarkdown: function () { parseMarkdown: function () {
if (!window.Vditor) { if (!window.Vditor) {
var xhrObj = new XMLHttpRequest() var xhrObj = new XMLHttpRequest()
xhrObj.open('GET', latkeConfig.staticServePath + xhrObj.open('GET', Label.staticServePath +
'/js/lib/vditor-1.1.10/index.min.js', false) '/js/lib/vditor-1.1.10/index.min.js', false)
xhrObj.setRequestHeader('Accept', xhrObj.setRequestHeader('Accept',
'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01') 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01')
...@@ -171,7 +171,7 @@ var Util = { ...@@ -171,7 +171,7 @@ var Util = {
var killIEHTML = '<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>' var killIEHTML = '<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:' + left + 'px;z-index:120;top: ' + top1 + + '<iframe style=\'left:' + left + 'px;z-index:120;top: ' + top1 +
'px; position: fixed; border: 0px none; width: 781px; height: 680px;\' src=\'' + 'px; position: fixed; border: 0px none; width: 781px; height: 680px;\' src=\'' +
latkeConfig.servePath + '/kill-browser\'></iframe>' Label.servePath + '/kill-browser\'></iframe>'
$('body').append(killIEHTML) $('body').append(killIEHTML)
} catch (e) { } catch (e) {
var left = 10, var left = 10,
...@@ -179,7 +179,7 @@ var Util = { ...@@ -179,7 +179,7 @@ var Util = {
var killIEHTML = '<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>' var killIEHTML = '<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:' + left + 'px;z-index:120;top: ' + top1 + + '<iframe style=\'left:' + left + 'px;z-index:120;top: ' + top1 +
'px; position: fixed; border: 0px none; width: 781px; height: 680px;\' src=\'' + 'px; position: fixed; border: 0px none; width: 781px; height: 680px;\' src=\'' +
latkeConfig.servePath + '/kill-browser\'></iframe>' Label.servePath + '/kill-browser\'></iframe>'
document.body.innerHTML = document.body.innerHTML + killIEHTML document.body.innerHTML = document.body.innerHTML + killIEHTML
} }
} }
...@@ -209,7 +209,7 @@ var Util = { ...@@ -209,7 +209,7 @@ var Util = {
str = commentSplited[0] str = commentSplited[0]
for (var j = 1; j < commentSplited.length; j++) { for (var j = 1; j < commentSplited.length; j++) {
var key = commentSplited[j].substr(0, 2) var key = commentSplited[j].substr(0, 2)
str += '<img width=\'20\' src=\'' + latkeConfig.staticServePath + str += '<img width=\'20\' src=\'' + Label.staticServePath +
'/images/emotions/em' + key + '.png\' alt=\'' + '/images/emotions/em' + key + '.png\' alt=\'' +
Label['em' + key + 'Label'] + '\' title=\'' + Label['em' + key + 'Label'] + '\' title=\'' +
Label['em' + key + 'Label'] + '\'/> ' + commentSplited[j].substr(3) Label['em' + key + 'Label'] + '\'/> ' + commentSplited[j].substr(3)
......
var Util={isArticlePage:function(e){var t=!0;return-1<e.indexOf(latkeConfig.servePath+"/tags/")&&(t=!1),-1<e.indexOf(latkeConfig.servePath+"/tags.html")&&(t=!1),-1<e.indexOf(latkeConfig.servePath+"/category/")&&(t=!1),-1<e.indexOf(latkeConfig.servePath+"/archives.html")&&(t=!1),-1<e.indexOf(latkeConfig.servePath+"/archives/")&&(t=!1),-1<e.indexOf(latkeConfig.servePath+"/links.html")&&(t=!1),e===latkeConfig.servePath&&(t=!1),/^[0-9]*$/.test(e.replace(latkeConfig.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===latkeConfig.servePath+"/rss.xml"||-1<e.indexOf(latkeConfig.servePath+"/admin-index.do")||!(-1<e.indexOf(latkeConfig.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(){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",latkeConfig.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='"+latkeConfig.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='"+latkeConfig.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='"+latkeConfig.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()),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=/"}}; 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(){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=/"}};
\ No newline at end of file \ No newline at end of file
...@@ -59,7 +59,7 @@ $.extend(Page.prototype, { ...@@ -59,7 +59,7 @@ $.extend(Page.prototype, {
toggleEditor: function (commentId, name) { toggleEditor: function (commentId, name) {
var $editor = $('#soloEditor') var $editor = $('#soloEditor')
if ($editor.length === 0) { if ($editor.length === 0) {
location.href = latkeConfig.servePath + '/start' location.href = Label.servePath + '/start'
return return
} }
...@@ -70,7 +70,7 @@ $.extend(Page.prototype, { ...@@ -70,7 +70,7 @@ $.extend(Page.prototype, {
height: 180, height: 180,
tab: '\t', tab: '\t',
hint: { hint: {
emojiPath: latkeConfig.staticServePath + emojiPath: Label.staticServePath +
'/js/lib/emojify.js-1.1.0/images/basic', '/js/lib/emojify.js-1.1.0/images/basic',
}, },
esc: function () { esc: function () {
...@@ -82,7 +82,7 @@ $.extend(Page.prototype, { ...@@ -82,7 +82,7 @@ $.extend(Page.prototype, {
preview: { preview: {
delay: 500, delay: 500,
show: false, show: false,
url: latkeConfig.servePath + '/console/markdown/2html', url: Label.servePath + '/console/markdown/2html',
hljs: { hljs: {
enable: true, enable: true,
style: Label.hljsStyle, style: Label.hljsStyle,
...@@ -157,7 +157,7 @@ $.extend(Page.prototype, { ...@@ -157,7 +157,7 @@ $.extend(Page.prototype, {
var randomArticles1Label = this.tips.randomArticles1Label var randomArticles1Label = this.tips.randomArticles1Label
// getRandomArticles // getRandomArticles
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/articles/random', url: Label.servePath + '/articles/random',
type: 'POST', type: 'POST',
success: function (result, textStatus) { success: function (result, textStatus) {
var randomArticles = result.randomArticles var randomArticles = result.randomArticles
...@@ -171,7 +171,7 @@ $.extend(Page.prototype, { ...@@ -171,7 +171,7 @@ $.extend(Page.prototype, {
var article = randomArticles[i] var article = randomArticles[i]
var title = article.articleTitle var title = article.articleTitle
var randomArticleLiHtml = '<li>' + '<a rel=\'nofollow\' title=\'' + var randomArticleLiHtml = '<li>' + '<a rel=\'nofollow\' title=\'' +
title + '\' href=\'' + latkeConfig.servePath + title + '\' href=\'' + Label.servePath +
article.articlePermalink + '\'>' + title + '</a></li>' article.articlePermalink + '\'>' + title + '</a></li>'
listHtml += randomArticleLiHtml listHtml += randomArticleLiHtml
} }
...@@ -191,7 +191,7 @@ $.extend(Page.prototype, { ...@@ -191,7 +191,7 @@ $.extend(Page.prototype, {
*/ */
loadRelevantArticles: function (id, headTitle) { loadRelevantArticles: function (id, headTitle) {
$.ajax({ $.ajax({
url: latkeConfig.servePath + '/article/id/' + id + '/relevant/articles', url: Label.servePath + '/article/id/' + id + '/relevant/articles',
type: 'GET', type: 'GET',
success: function (data, textStatus) { success: function (data, textStatus) {
var articles = data.relevantArticles var articles = data.relevantArticles
...@@ -205,7 +205,7 @@ $.extend(Page.prototype, { ...@@ -205,7 +205,7 @@ $.extend(Page.prototype, {
var title = article.articleTitle var title = article.articleTitle
var articleLiHtml = '<li>' var articleLiHtml = '<li>'
+ '<a rel=\'nofollow\' title=\'' + title + '\' href=\'' + + '<a rel=\'nofollow\' title=\'' + title + '\' href=\'' +
latkeConfig.servePath + article.articlePermalink + '\'>' Label.servePath + article.articlePermalink + '\'>'
+ title + '</a></li>' + title + '</a></li>'
listHtml += articleLiHtml listHtml += articleLiHtml
} }
...@@ -292,7 +292,7 @@ $.extend(Page.prototype, { ...@@ -292,7 +292,7 @@ $.extend(Page.prototype, {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: latkeConfig.servePath + '/' + type + '/comments', url: Label.servePath + '/' + type + '/comments',
cache: false, cache: false,
contentType: 'application/json', contentType: 'application/json',
data: JSON.stringify(requestJSONObject), data: JSON.stringify(requestJSONObject),
......
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 n=t[o].innerHTML;t[o].innerHTML=Util.replaceEmString(n)}},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: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",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=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 n="",i=0;i<o.length;i++){var l=o[i],r=l.articleTitle;n+="<li><a rel='nofollow' title='"+r+"' href='"+latkeConfig.servePath+l.articlePermalink+"'>"+r+"</a></li>"}var a=(s||"<h4>"+c+"</h4>")+"<ul>"+n+"</ul>";$("#randomArticles").append(a)}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 n="",i=0;i<o.length;i++){var l=o[i],r=l.articleTitle;n+="<li><a rel='nofollow' title='"+r+"' href='"+latkeConfig.servePath+l.articlePermalink+"'>"+r+"</a></li>"}var a=s+"<ul>"+n+"</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 n="",i=0;i<o.length;i++){var l=o[i],r=l.articleTitle;n+="<li><a rel='nofollow' title='"+r+"' target='_blank' href='"+l.articlePermalink+"'>"+r+"</a></li>"}var a=(s||"<h4>"+c.externalRelevantArticles1Label+"</h4>")+"<ul>"+n+"</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 n={oId:e.oId,commentContent:vditor.getValue()};this.currentCommentId&&(n.commentOriginalCommentId=this.currentCommentId),$.ajax({type:"POST",url:latkeConfig.servePath+"/"+o+"/comments",cache:!1,contentType:"application/json",data:JSON.stringify(n),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,n){var i=parseInt($(e).position().top);if(n&&(i=parseInt($(e).parents(n).position().top)),0<$("#commentRef"+t).length)$("#commentRef"+t).show().css("top",i+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",i+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("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 \ No newline at end of file
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