Commit 0c8c43b2 authored by Van's avatar Van

🎨 #12720 #4

parent 5fdf2e59
This diff is collapsed.
......@@ -40,7 +40,7 @@
};
$.ajax({
url: latkeConfig.servePath + "/console/plugin/updateSetting",
url: Label.servePath + "/console/plugin/updateSetting",
type: "POST",
cache: false,
data: JSON.stringify(requestJSONObject),
......
var latkeConfig = {
"servePath": "${servePath}",
"staticServePath": "${staticServePath}",
"isLoggedIn": "${isLoggedIn?string}",
"userName": "${userName}"
};
<#--
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 Label = {
"servePath": "${servePath}",
"staticServePath": "${staticServePath}",
"markedAvailable": ${markedAvailable?c},
"hljsStyle": "atom-one-light",
"langLabel": "${langLabel}",
"skinDirName": "${skinDirName}"
};
\ No newline at end of file
"langLabel": "${langLabel}"
};
......@@ -57,7 +57,7 @@ $.extend(Admin.prototype, {
* @description 登出
*/
logout: function () {
window.location.href = latkeConfig.servePath + '/logout'
window.location.href = Label.servePath + '/logout'
},
toggleMenu: function () {
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 = {
$('#loadMsg').text(Label.loadingLabel)
$('#tipMsg').text('')
$.ajax({
url: latkeConfig.servePath + '/console/article/' +
url: Label.servePath + '/console/article/' +
admin.article.status.id,
type: 'GET',
cache: false,
......@@ -115,7 +115,7 @@ admin.article = {
$('#tipMsg').text('')
$.ajax({
url: latkeConfig.servePath + '/console/article/' + id,
url: Label.servePath + '/console/article/' + id,
type: 'DELETE',
cache: false,
success: function (result, textStatus) {
......@@ -176,7 +176,7 @@ admin.article = {
}
$.ajax({
url: latkeConfig.servePath + '/console/article/',
url: Label.servePath + '/console/article/',
type: 'POST',
cache: false,
data: JSON.stringify(requestJSONObject),
......@@ -253,7 +253,7 @@ admin.article = {
}
$.ajax({
url: latkeConfig.servePath + '/console/article/',
url: Label.servePath + '/console/article/',
type: 'PUT',
cache: false,
data: JSON.stringify(requestJSONObject),
......@@ -291,7 +291,7 @@ admin.article = {
*/
setStatus: function () {
$.ajax({// Gets all tags
url: latkeConfig.servePath + '/console/tags',
url: Label.servePath + '/console/tags',
type: 'GET',
cache: false,
success: function (result, textStatus) {
......@@ -383,7 +383,7 @@ admin.article = {
// For tag auto-completion
$.ajax({// Gets all tags
url: latkeConfig.servePath + '/console/tags',
url: Label.servePath + '/console/tags',
type: 'GET',
cache: false,
success: function (result, textStatus) {
......@@ -453,7 +453,7 @@ admin.article = {
// thumbnail
$('#articleThumbnailBtn').click(function () {
$.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',
cache: false,
success: function (result, textStatus) {
......@@ -519,7 +519,7 @@ admin.article = {
var that = this
that._addDisabled()
$.ajax({
url: latkeConfig.servePath + '/console/article/unpublish/' +
url: Label.servePath + '/console/article/unpublish/' +
admin.article.status.id,
type: 'PUT',
cache: false,
......
......@@ -74,7 +74,7 @@ admin.articleList = {
*/
syncToHacpai: function (id) {
$.ajax({
url: latkeConfig.servePath + '/console/article/push2rhy?id=' + id,
url: Label.servePath + '/console/article/push2rhy?id=' + id,
type: 'GET',
cache: false,
success: function (result, textStatus) {
......@@ -91,7 +91,7 @@ admin.articleList = {
var that = this
$('#loadMsg').text(Label.loadingLabel)
$.ajax({
url: latkeConfig.servePath + '/console/articles/status/published/' +
url: Label.servePath + '/console/articles/status/published/' +
pageNum + '/' + Label.PAGE_SIZE + '/' + Label.WINDOW_SIZE + '?k=' +
$('#articleListInput').val(),
type: 'GET',
......@@ -107,7 +107,7 @@ admin.articleList = {
articleData = []
for (var i = 0; i < articles.length; 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].articleTitle + '\' class=\'no-underline\'>'
+ articles[i].articleTitle + '</a><span class=\'table-tag\'>' +
......@@ -163,7 +163,7 @@ admin.articleList = {
}
$.ajax({
url: latkeConfig.servePath + '/console/article/' + ajaxUrl + '/' + id,
url: Label.servePath + '/console/article/' + ajaxUrl + '/' + id,
type: 'PUT',
cache: false,
success: function (result, textStatus) {
......
......@@ -70,7 +70,7 @@ admin.categoryList = {
// For tag auto-completion
$.ajax({// Gets all tags
url: latkeConfig.servePath + "/console/tags",
url: Label.servePath + "/console/tags",
type: "GET",
cache: false,
success: function (result, textStatus) {
......@@ -110,7 +110,7 @@ admin.categoryList = {
var that = this;
$.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",
cache: false,
success: function(result, textStatus) {
......@@ -177,7 +177,7 @@ admin.categoryList = {
};
$.ajax({
url: latkeConfig.servePath + "/console/category/",
url: Label.servePath + "/console/category/",
type: "POST",
cache: false,
data: JSON.stringify(requestJSONObject),
......@@ -218,7 +218,7 @@ admin.categoryList = {
$("#categoryUpdate").dialog("open");
$.ajax({
url: latkeConfig.servePath + "/console/category/" + id,
url: Label.servePath + "/console/category/" + id,
type: "GET",
cache: false,
success: function(result, textStatus) {
......@@ -254,7 +254,7 @@ admin.categoryList = {
};
$.ajax({
url: latkeConfig.servePath + "/console/category/",
url: Label.servePath + "/console/category/",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
......@@ -285,7 +285,7 @@ admin.categoryList = {
$("#tipMsg").text("");
$.ajax({
url: latkeConfig.servePath + "/console/category/" + id,
url: Label.servePath + "/console/category/" + id,
type: "DELETE",
cache: false,
success: function(result, textStatus) {
......@@ -345,7 +345,7 @@ admin.categoryList = {
};
$.ajax({
url: latkeConfig.servePath + "/console/category/order/",
url: Label.servePath + "/console/category/order/",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
......
......@@ -51,7 +51,7 @@ admin.comment = {
}
$.ajax({
url: latkeConfig.servePath + '/console/comments/' + from + '/' + onId,
url: Label.servePath + '/console/comments/' + from + '/' + onId,
type: 'GET',
cache: false,
success: function (result, textStatus) {
......@@ -117,7 +117,7 @@ admin.comment = {
}
$.ajax({
url: latkeConfig.servePath + '/console/' + from + '/comment/' + id,
url: Label.servePath + '/console/' + from + '/comment/' + id,
type: 'DELETE',
cache: false,
success: function (result, textStatus) {
......
......@@ -64,7 +64,7 @@ admin.commentList = {
$('#loadMsg').text(Label.loadingLabel)
$.ajax({
url: latkeConfig.servePath + '/console/comments/' + pageNum + '/' +
url: Label.servePath + '/console/comments/' + pageNum + '/' +
Label.PAGE_SIZE + '/' + Label.WINDOW_SIZE,
type: 'GET',
cache: false,
......@@ -89,7 +89,7 @@ admin.commentList = {
commentsData[i].content = '<div class="vditor-reset">' +
Util.replaceEmString(comments[i].commentContent) +
'</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 +
'</a>'
......@@ -132,7 +132,7 @@ admin.commentList = {
$('#loadMsg').text(Label.loadingLabel)
$.ajax({
url: latkeConfig.servePath + '/console/' + type.toLowerCase() +
url: Label.servePath + '/console/' + type.toLowerCase() +
'/comment/' + id,
type: 'DELETE',
cache: false,
......
......@@ -71,7 +71,7 @@ admin.draftList = {
var that = this;
$.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",
cache: false,
success: function(result, textStatus){
......@@ -90,7 +90,7 @@ admin.draftList = {
articleData[i].comments = articles[i].articleCommentCount;
articleData[i].articleViewCount = articles[i].articleViewCount;
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].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> \
......
......@@ -45,12 +45,12 @@ $.extend(SoloEditor.prototype, {
cache: true,
tab: '\t',
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: {
delay: 500,
show: this.conf.previewShow,
url: latkeConfig.servePath + '/console/markdown/2html',
url: Label.servePath + '/console/markdown/2html',
parse: function(element) {
if (element.style.display === 'none') {
return
......
......@@ -83,7 +83,7 @@ admin.linkList = {
var that = this;
$.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",
cache: false,
success: function(result, textStatus){
......@@ -151,7 +151,7 @@ admin.linkList = {
};
$.ajax({
url: latkeConfig.servePath + "/console/link/",
url: Label.servePath + "/console/link/",
type: "POST",
cache: false,
data: JSON.stringify(requestJSONObject),
......@@ -191,7 +191,7 @@ admin.linkList = {
$("#updateLink").dialog("open");
$.ajax({
url: latkeConfig.servePath + "/console/link/" + id,
url: Label.servePath + "/console/link/" + id,
type: "GET",
cache: false,
success: function(result, textStatus){
......@@ -229,7 +229,7 @@ admin.linkList = {
};
$.ajax({
url: latkeConfig.servePath + "/console/link/",
url: Label.servePath + "/console/link/",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
......@@ -261,7 +261,7 @@ admin.linkList = {
$("#tipMsg").text("");
$.ajax({
url: latkeConfig.servePath + "/console/link/" + id,
url: Label.servePath + "/console/link/" + id,
type: "DELETE",
cache: false,
success: function(result, textStatus){
......@@ -327,7 +327,7 @@ admin.linkList = {
};
$.ajax({
url: latkeConfig.servePath + "/console/link/order/",
url: Label.servePath + "/console/link/order/",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
......
......@@ -39,7 +39,7 @@ admin.others = {
$("#tipMsg").text("");
$.ajax({
url: latkeConfig.servePath + "/console/tag/unused",
url: Label.servePath + "/console/tag/unused",
type: "DELETE",
cache: false,
success: function (result, textStatus) {
......@@ -54,14 +54,14 @@ admin.others = {
$("#tipMsg").text("");
$.ajax({
url: latkeConfig.servePath + "/console/export/sql",
url: Label.servePath + "/console/export/sql",
type: "GET",
cache: false,
success: function (result, textStatus) {
// AJAX 下载文件的话这里会发两次请求,用 sc 来判断是否是文件,如果没有 sc 说明文件可以下载(实际上就是 result)
if (!result.sc) {
// 再发一次请求进行正式下载
window.location = latkeConfig.servePath + "/console/export/sql";
window.location = Label.servePath + "/console/export/sql";
} else {
$("#tipMsg").text(result.msg);
}
......@@ -75,14 +75,14 @@ admin.others = {
$("#tipMsg").text("");
$.ajax({
url: latkeConfig.servePath + "/console/export/json",
url: Label.servePath + "/console/export/json",
type: "GET",
cache: false,
success: function (result, textStatus) {
// AJAX 下载文件的话这里会发两次请求,用 sc 来判断是否是文件,如果没有 sc 说明文件可以下载(实际上就是 result)
if (!result.sc) {
// 再发一次请求进行正式下载
window.location = latkeConfig.servePath + "/console/export/json";
window.location = Label.servePath + "/console/export/json";
} else {
$("#tipMsg").text(result.msg);
}
......@@ -96,14 +96,14 @@ admin.others = {
$("#tipMsg").text("");
$.ajax({
url: latkeConfig.servePath + "/console/export/hexo",
url: Label.servePath + "/console/export/hexo",
type: "GET",
cache: false,
success: function (result, textStatus) {
// AJAX 下载文件的话这里会发两次请求,用 sc 来判断是否是文件,如果没有 sc 说明文件可以下载(实际上就是 result)
if (!result.sc) {
// 再发一次请求进行正式下载
window.location = latkeConfig.servePath + "/console/export/hexo";
window.location = Label.servePath + "/console/export/hexo";
} else {
$("#tipMsg").text(result.msg);
}
......@@ -116,7 +116,7 @@ admin.others = {
*/
getUnusedTags: function () {
$.ajax({
url: latkeConfig.servePath + "/console/tag/unused",
url: Label.servePath + "/console/tag/unused",
type: "GET",
cache: false,
success: function (result, textStatus) {
......
......@@ -105,7 +105,7 @@ admin.pageList = {
var that = this;
$.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",
cache: false,
success: function (result, textStatus) {
......@@ -172,7 +172,7 @@ admin.pageList = {
$("#tipMsg").text("");
$.ajax({
url: latkeConfig.servePath + "/console/page/" + id,
url: Label.servePath + "/console/page/" + id,
type: "GET",
cache: false,
success: function (result, textStatus) {
......@@ -213,7 +213,7 @@ admin.pageList = {
$("#tipMsg").text("");
$.ajax({
url: latkeConfig.servePath + "/console/page/" + id,
url: Label.servePath + "/console/page/" + id,
type: "DELETE",
cache: false,
success: function (result, textStatus) {
......@@ -269,7 +269,7 @@ admin.pageList = {
};
$.ajax({
url: latkeConfig.servePath + "/console/page/",
url: Label.servePath + "/console/page/",
type: "POST",
cache: false,
data: JSON.stringify(requestJSONObject),
......@@ -336,7 +336,7 @@ admin.pageList = {
};
$.ajax({
url: latkeConfig.servePath + "/console/page/",
url: Label.servePath + "/console/page/",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
......@@ -402,7 +402,7 @@ admin.pageList = {
};
$.ajax({
url: latkeConfig.servePath + "/console/page/order/",
url: Label.servePath + "/console/page/order/",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
......
......@@ -76,7 +76,7 @@ admin.pluginList = {
var that = this;
$.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",
cache: false,
success: function(result, textStatus) {
......@@ -119,7 +119,7 @@ admin.pluginList = {
};
$.ajax({
url: latkeConfig.servePath + "/console/plugin/toSetting",
url: Label.servePath + "/console/plugin/toSetting",
type: "POST",
cache: false,
data: JSON.stringify(requestJSONObject),
......@@ -148,7 +148,7 @@ admin.pluginList = {
};
$.ajax({
url: latkeConfig.servePath + "/console/plugin/status/",
url: Label.servePath + "/console/plugin/status/",
type: "PUT",
cache: false,
data: JSON.stringify(requestJSONObject),
......
......@@ -33,7 +33,7 @@ admin.preference = {
$('#tabPreference').tabs()
$.ajax({
url: latkeConfig.servePath + '/console/preference/',
url: Label.servePath + '/console/preference/',
type: 'GET',
cache: false,
success: function (result, textStatus) {
......@@ -95,10 +95,10 @@ admin.preference = {
'"><div class="ft__center">' +
skins[i].skinName
+ '</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="' +
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 + '\')">'
+ Label.previewLabel + '</button></div></div>'
}
......@@ -261,7 +261,7 @@ admin.preference = {
}
$.ajax({
url: latkeConfig.servePath + '/console/preference/',
url: Label.servePath + '/console/preference/',
type: 'PUT',
cache: false,
data: JSON.stringify(requestJSONObject),
......
......@@ -73,7 +73,7 @@ admin.userList = {
var that = this
$.ajax({
url: latkeConfig.servePath + '/console/users/' + pageNum + '/' +
url: Label.servePath + '/console/users/' + pageNum + '/' +
Label.PAGE_SIZE + '/' + Label.WINDOW_SIZE,
type: 'GET',
cache: false,
......@@ -138,7 +138,7 @@ admin.userList = {
$('#userUpdate').dialog('open')
$.ajax({
url: latkeConfig.servePath + '/console/user/' + id,
url: Label.servePath + '/console/user/' + id,
type: 'GET',
cache: false,
success: function (result, textStatus) {
......@@ -179,7 +179,7 @@ admin.userList = {
}
$.ajax({
url: latkeConfig.servePath + '/console/user/',
url: Label.servePath + '/console/user/',
type: 'PUT',
cache: false,
data: JSON.stringify(requestJSONObject),
......@@ -211,7 +211,7 @@ admin.userList = {
$('#tipMsg').text('')
$.ajax({
url: latkeConfig.servePath + '/console/user/' + id,
url: Label.servePath + '/console/user/' + id,
type: 'DELETE',
cache: false,
success: function (result, textStatus) {
......@@ -247,7 +247,7 @@ admin.userList = {
changeRole: function (id) {
$('#tipMsg').text('')
$.ajax({
url: latkeConfig.servePath + '/console/changeRole/' + id,
url: Label.servePath + '/console/changeRole/' + id,
type: 'GET',
cache: false,
success: function (result, textStatus) {
......
......@@ -30,28 +30,28 @@
var Util = {
isArticlePage: function (href) {
var isArticle = true
if (href.indexOf(latkeConfig.servePath + '/tags/') > -1) {
if (href.indexOf(Label.servePath + '/tags/') > -1) {
isArticle = false
}
if (href.indexOf(latkeConfig.servePath + '/tags.html') > -1) {
if (href.indexOf(Label.servePath + '/tags.html') > -1) {
isArticle = false
}
if (href.indexOf(latkeConfig.servePath + '/category/') > -1) {
if (href.indexOf(Label.servePath + '/category/') > -1) {
isArticle = false
}
if (href.indexOf(latkeConfig.servePath + '/archives.html') > -1) {
if (href.indexOf(Label.servePath + '/archives.html') > -1) {
isArticle = false
}
if (href.indexOf(latkeConfig.servePath + '/archives/') > -1) {
if (href.indexOf(Label.servePath + '/archives/') > -1) {
isArticle = false
}
if (href.indexOf(latkeConfig.servePath + '/links.html') > -1) {
if (href.indexOf(Label.servePath + '/links.html') > -1) {
isArticle = false
}
if (href === latkeConfig.servePath) {
if (href === Label.servePath) {
isArticle = false
}
if (/^[0-9]*$/.test(href.replace(latkeConfig.servePath + '/', ''))) {
if (/^[0-9]*$/.test(href.replace(Label.servePath + '/', ''))) {
isArticle = false
}
return isArticle
......@@ -70,11 +70,11 @@ var Util = {
storage: true,
titleSuffix: '',
filter: function (href) {
if (href === latkeConfig.servePath + '/rss.xml' ||
href.indexOf(latkeConfig.servePath + '/admin-index.do') > -1) {
if (href === Label.servePath + '/rss.xml' ||
href.indexOf(Label.servePath + '/admin-index.do') > -1) {
return true
}
if (href.indexOf(latkeConfig.servePath) > -1) {
if (href.indexOf(Label.servePath) > -1) {
return false
}
return true
......@@ -144,7 +144,7 @@ var Util = {
parseMarkdown: function () {
if (!window.Vditor) {
var xhrObj = new XMLHttpRequest()
xhrObj.open('GET', latkeConfig.staticServePath +
xhrObj.open('GET', Label.staticServePath +
'/js/lib/vditor-1.1.10/index.min.js', false)
xhrObj.setRequestHeader('Accept',
'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01')
......@@ -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>'
+ '<iframe style=\'left:' + left + 'px;z-index:120;top: ' + top1 +
'px; position: fixed; border: 0px none; width: 781px; height: 680px;\' src=\'' +
latkeConfig.servePath + '/kill-browser\'></iframe>'
Label.servePath + '/kill-browser\'></iframe>'
$('body').append(killIEHTML)
} catch (e) {
var left = 10,
......@@ -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>'
+ '<iframe style=\'left:' + left + 'px;z-index:120;top: ' + top1 +
'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
}
}
......@@ -209,7 +209,7 @@ var Util = {
str = commentSplited[0]
for (var j = 1; j < commentSplited.length; j++) {
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=\'' +
Label['em' + key + 'Label'] + '\' title=\'' +
Label['em' + key + 'Label'] + '\'/> ' + commentSplited[j].substr(3)
......
This diff is collapsed.
......@@ -59,7 +59,7 @@ $.extend(Page.prototype, {
toggleEditor: function (commentId, name) {
var $editor = $('#soloEditor')
if ($editor.length === 0) {
location.href = latkeConfig.servePath + '/start'
location.href = Label.servePath + '/start'
return
}
......@@ -70,7 +70,7 @@ $.extend(Page.prototype, {
height: 180,
tab: '\t',
hint: {
emojiPath: latkeConfig.staticServePath +
emojiPath: Label.staticServePath +
'/js/lib/emojify.js-1.1.0/images/basic',
},
esc: function () {
......@@ -82,7 +82,7 @@ $.extend(Page.prototype, {
preview: {
delay: 500,
show: false,
url: latkeConfig.servePath + '/console/markdown/2html',
url: Label.servePath + '/console/markdown/2html',
hljs: {
enable: true,
style: Label.hljsStyle,
......@@ -157,7 +157,7 @@ $.extend(Page.prototype, {
var randomArticles1Label = this.tips.randomArticles1Label
// getRandomArticles
$.ajax({
url: latkeConfig.servePath + '/articles/random',
url: Label.servePath + '/articles/random',
type: 'POST',
success: function (result, textStatus) {
var randomArticles = result.randomArticles
......@@ -171,7 +171,7 @@ $.extend(Page.prototype, {
var article = randomArticles[i]
var title = article.articleTitle
var randomArticleLiHtml = '<li>' + '<a rel=\'nofollow\' title=\'' +
title + '\' href=\'' + latkeConfig.servePath +
title + '\' href=\'' + Label.servePath +
article.articlePermalink + '\'>' + title + '</a></li>'
listHtml += randomArticleLiHtml
}
......@@ -191,7 +191,7 @@ $.extend(Page.prototype, {
*/
loadRelevantArticles: function (id, headTitle) {
$.ajax({
url: latkeConfig.servePath + '/article/id/' + id + '/relevant/articles',
url: Label.servePath + '/article/id/' + id + '/relevant/articles',
type: 'GET',
success: function (data, textStatus) {
var articles = data.relevantArticles
......@@ -205,7 +205,7 @@ $.extend(Page.prototype, {
var title = article.articleTitle
var articleLiHtml = '<li>'
+ '<a rel=\'nofollow\' title=\'' + title + '\' href=\'' +
latkeConfig.servePath + article.articlePermalink + '\'>'
Label.servePath + article.articlePermalink + '\'>'
+ title + '</a></li>'
listHtml += articleLiHtml
}
......@@ -292,7 +292,7 @@ $.extend(Page.prototype, {
$.ajax({
type: 'POST',
url: latkeConfig.servePath + '/' + type + '/comments',
url: Label.servePath + '/' + type + '/comments',
cache: false,
contentType: 'application/json',
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"}});
\ No newline at end of file
var Page=function(e){this.currentCommentId="",this.tips=e};$.extend(Page.prototype,{replaceCommentsEm:function(e){for(var t=$(e),o=0;o<t.length;o++){var l=t[o].innerHTML;t[o].innerHTML=Util.replaceEmString(l)}},load:function(){var e=this;$("#comment").click(function(){e.toggleEditor()}).attr("readonly","readonly"),$("#soloEditorCancel").click(function(){e.toggleEditor()}),$("#soloEditorAdd").click(function(){e.submitComment()})},toggleEditor:function(e,t){var o=$("#soloEditor");if(0!==o.length){if("undefined"==typeof vditor){window.vditor=new Vditor("soloEditorComment",{placeholder:this.tips.commentContentCannotEmptyLabel,height:180,tab:"\t",hint:{emojiPath:Label.staticServePath+"/js/lib/emojify.js-1.1.0/images/basic"},esc:function(){$("#soloEditorCancel").click()},ctrlEnter:function(){$("#soloEditorAdd").click()},preview:{delay:500,show:!1,url:Label.servePath+"/console/markdown/2html",hljs:{enable:!0,style:Label.hljsStyle},parse:function(e){"none"!==e.style.display&&Util.parseLanguage()}},counter:500,resize:{enable:!0,position:"top",after:function(){$("body").css("padding-bottom",$("#soloEditor").outerHeight())}},lang:Label.langLabel,toolbar:["emoji","headings","bold","italic","strike","|","line","quote","|","list","ordered-list","check","|","code","inline-code","|","undo","redo","|","link","table","|","preview","fullscreen","info","help"]}),vditor.focus()}"0px"===$("body").css("padding-bottom")||e?($("#soloEditorError").text(""),o.css({bottom:"0",opacity:1}),$("body").css("padding-bottom","238px"),this.currentCommentId=e,$("#soloEditorReplyTarget").text(t?"@"+t:""),"undefined"!=typeof vditor&&vditor.focus()):(o.css({bottom:"-300px",opacity:0}),$("body").css("padding-bottom",0))}else location.href=Label.servePath+"/start"},loadRandomArticles:function(s){var c=this.tips.randomArticles1Label;$.ajax({url:Label.servePath+"/articles/random",type:"POST",success:function(e,t){var o=e.randomArticles;if(o&&0!==o.length){for(var l="",n=0;n<o.length;n++){var r=o[n],i=r.articleTitle;l+="<li><a rel='nofollow' title='"+i+"' href='"+Label.servePath+r.articlePermalink+"'>"+i+"</a></li>"}var a=(s||"<h4>"+c+"</h4>")+"<ul>"+l+"</ul>";$("#randomArticles").append(a)}else $("#randomArticles").remove()}})},loadRelevantArticles:function(e,s){$.ajax({url:Label.servePath+"/article/id/"+e+"/relevant/articles",type:"GET",success:function(e,t){var o=e.relevantArticles;if(o&&0!==o.length){for(var l="",n=0;n<o.length;n++){var r=o[n],i=r.articleTitle;l+="<li><a rel='nofollow' title='"+i+"' href='"+Label.servePath+r.articlePermalink+"'>"+i+"</a></li>"}var a=s+"<ul>"+l+"</ul>";$("#relevantArticles").append(a)}else $("#relevantArticles").remove()},error:function(){$("#relevantArticles").remove()}})},loadExternalRelevantArticles:function(e,s){var c=this.tips;try{$.ajax({url:"https://rhythm.b3log.org/get-articles-by-tags.do?tags="+e+"&blogHost="+c.blogHost+"&paginationPageSize="+c.externalRelevantArticlesDisplayCount,type:"GET",cache:!0,dataType:"jsonp",error:function(){$("#externalRelevantArticles").remove()},success:function(e,t){var o=e.articles;if(o&&0!==o.length){for(var l="",n=0;n<o.length;n++){var r=o[n],i=r.articleTitle;l+="<li><a rel='nofollow' title='"+i+"' target='_blank' href='"+r.articlePermalink+"'>"+i+"</a></li>"}var a=(s||"<h4>"+c.externalRelevantArticles1Label+"</h4>")+"<ul>"+l+"</ul>";$("#externalRelevantArticles").append(a)}else $("#externalRelevantArticles").remove()}})}catch(e){}},submitComment:function(){var t=this,e=this.tips,o="article";if(void 0===e.externalRelevantArticlesDisplayCount&&(o="page"),1<vditor.getValue().length&&vditor.getValue().length<500){$("#soloEditorAdd").attr("disabled","disabled");var l={oId:e.oId,commentContent:vditor.getValue()};this.currentCommentId&&(l.commentOriginalCommentId=this.currentCommentId),$.ajax({type:"POST",url:Label.servePath+"/"+o+"/comments",cache:!1,contentType:"application/json",data:JSON.stringify(l),success:function(e){$("#soloEditorAdd").removeAttr("disabled"),e.sc?(t.toggleEditor(),vditor.setValue(""),t.addCommentAjax(Util.replaceEmString(e.cmtTpl))):$("#soloEditorError").html(e.msg)}})}else $("#soloEditorError").text(t.tips.commentContentCannotEmptyLabel)},addReplyForm:function(e,t){this.currentCommentId=e,this.toggleEditor(e,t)},hideComment:function(e){$("#commentRef"+e).hide()},showComment:function(e,t,o,l){var n=parseInt($(e).position().top);if(l&&(n=parseInt($(e).parents(l).position().top)),0<$("#commentRef"+t).length)$("#commentRef"+t).show().css("top",n+o+"px");else{var r=$("#"+t).clone();r.addClass("comment-body-ref").attr("id","commentRef"+t),r.find("#replyForm").remove(),$("#comments").append(r),$("#commentRef"+t).css("top",n+o+"px")}},addCommentAjax:function(e){0<$("#comments").children().length?$($("#comments").children()[0]).before(e):$("#comments").html(e),Util.parseMarkdown(),Util.parseLanguage(),window.location.hash="#comments"}});
\ 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