refactor:新增自定义页面(文章,留言板)

This commit is contained in:
jiewenhuang 2023-08-12 19:17:34 +08:00
parent 60e099407d
commit 8e49532406
6 changed files with 473 additions and 192 deletions

View File

@ -157,4 +157,152 @@ spec:
formSchema:
- $formkit: "text"
name: "icon"
label: "图标"
label: "图标"
---
apiVersion: v1alpha1
kind: AnnotationSetting
metadata:
generateName: annotation-setting-
spec:
targetRef:
group: content.halo.run
kind: SinglePage
formSchema:
- $formkit: "select"
name: "enable_aside"
label: "是否启用侧边栏"
value: "true"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "select"
name: "enable_page_meta"
label: "是否展示页面元信息(即顶部的字数、阅读量等数据)"
value: "true"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "select"
name: "enable_passage_tips"
label: "是否展示温馨提示"
value: "true"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "select"
name: "enable_collect_check"
label: "是否启用百度收录检查"
value: "true"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "select"
name: "enable_read_limit"
label: "是否开启评论后可见"
value: "false"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "select"
name: "use_raw_content"
label: "是否渲染原始内容"
value: "false"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "select"
name: "enable_comment"
label: "是否启用评论功能"
value: "true"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "select"
name: "enable_toc"
label: "是否启用 Toc 目录"
value: "true"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "text"
name: "toc_depth"
label: "Toc 目录默认展开层级 0~6对应标题层级 h1 h6"
value: "0"
- $formkit: "text"
name: "img_max_width"
label: "图片最大宽度"
value: "100%"
- $formkit: "select"
name: "img_align"
label: "图片对齐方式"
value: "center"
options:
- value: "center"
label: 居中
- value: "left"
label: 左对齐
- value: "right"
label: 右对齐
- $formkit: "select"
name: "enable_copy"
label: "是否允许复制内容"
value: "true"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "select"
name: "enable_donate"
label: "是否启用打赏(必须配置好相应二维码)"
value: "true"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "select"
name: "enable_share"
label: "是否启用分享"
value: "true"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "select"
name: "enable_like"
label: "是否启用点赞"
value: "true"
options:
- value: "true"
label:
- value: "false"
label:
- $formkit: "select"
name: "enable_fold_long_code"
label: "是否开启长代码块自动折叠"
value: "true"
options:
- value: "true"
label:
- value: "false"
label:

View File

@ -1,184 +1,93 @@
/**留言页逻辑 */
const leavingContext = {
/* 获取留言板数据 */
getData() {
const sheetId = $(".joe_detail__title").attr("data-sheetid");
const $leavingList = $(".joe_leaving-list");
const $leavingNone = $(".joe_leaving-none");
const $leavingLoading = $(".joe_loading");
Utils.request({
url: `/api/content/sheets/${sheetId}/comments/top_view`,
method: "GET",
data: {
page: 0,
// size: ThemeConfig_leaving_card_max,
sort: "createTime,desc",
},
})
.then((res) => {
if (res.total) {
const str = res.content.reduce((sum, item) => {
if (item.content.trim()) {
// 渲染留言中的 emoji
const markedHtml = marked(item.content)
.replace(/<img\ssrc[^>]*>/gm, "[图片内容]")
.replace(/bili\//g, "bili/hd/ic_emoji_");
const emoji = Utils.renderedEmojiHtml(markedHtml);
item.content = Utils.return2Br(emoji);
}
const avatar = `${
ThemeConfig_gravatar_source || ThemeConfig_gravatar_source_url
}/${item.gravatarMd5}?s=256&d=${ThemeConfig_gravatar_type}`;
return (sum += `<li class="item">
<div class="user">
<img class="avatar lazyload" src="${
ThemeConfig_lazyload_avatar
}" data-src="${avatar}" alt="用户头像" onerror="Joe.errorImg(this,${
ThemeConfig_comment_avatar_error
})"/>
<div class="nickname">${item.author}</div>
<div class="date">${new Date(
item.createTime
).toLocaleDateString()}</div>
</div>
<div class="wrapper">
<div class="content leaving-content">${item.content}</div>
</div>
</li>`);
}, "");
$leavingList.html(str);
leavingContext.randomColor();
} else {
$leavingList.hide();
$leavingNone.show();
}
$leavingLoading && $leavingLoading.hide();
})
.catch((_err) => {
$leavingLoading && $leavingLoading.hide();
$leavingList.hide();
$leavingNone.show();
});
},
// /* 设置标题 */
// setTitleText() {
// if (
// !ThemeConfig_leaving_title ||
// ThemeConfig_leaving_title.trim() === "留言板"
// )
// return;
// $(".joe_detail__title").text(ThemeConfig_leaving_title);
// },
/* 设置无数据文案 */
setEmptyText() {
if (
!$(".joe_leaving-none.tpl").length ||
!ThemeConfig_leaving_empty_text ||
ThemeConfig_leaving_empty_text.trim() === "暂无留言,期待第一个脚印。"
)
return;
$(".joe_leaving-none").text(ThemeConfig_leaving_empty_text);
},
/* 随机样式 */
randomColor() {
let _index = 100;
const colors = [
"#dcc10c",
"#299bec",
"#ea5455",
"#7367f0",
"#32ccbb",
"#f6416c",
"#28c76f",
"#9f44d3",
"#f55555",
"#736efe",
"#e96d71",
"#de4313",
"#d939cd",
"#4c83ff",
"#f072b6",
"#c346c2",
"#5961f9",
"#fd6585",
"#465efb",
"#ffc600",
"#fa742b",
"#5151e5",
"#bb4e75",
"#e255cd",
"#63c549",
"#0ecdde",
"#f067b4",
"#f067b4",
"#ff9a9e",
"#1dd5de",
"#4facfe",
"#f093fb",
"#6fa3ef",
"#bc99c4",
"#46c47c",
"#f9bb3c",
"#e8583d",
"#f68e5f",
];
const random = (min, max) =>
Math.floor(Math.random() * (max - min + 1)) + min;
const $el = $(".joe_leaving-list");
const maxWidth = $el.width();
const maxHeight = $el.height();
const radius1 = [
"20px 300px",
"20px 400px",
"20px 500px",
"30px 300px",
"30px 400px",
"30px 500px",
"40px 300px",
"40px 400px",
"40px 500px",
];
const radius2 = [
"300px 20px",
"400px 20px",
"500px 20px",
"300px 30px",
"400px 30px",
"500px 30px",
"300px 40px",
"400px 40px",
"500px 40px",
];
$(".joe_leaving-list .item").each((index, item) => {
const zIndex = random(1, 99);
const background = colors[random(0, colors.length - 1)];
const width = Math.ceil($(item).width());
const height = Math.ceil($(item).height());
const top = random(0, maxHeight - height);
const left = random(0, maxWidth - width);
$(item).css({
display: "block",
zIndex,
background,
top,
left,
borderTopLeftRadius: radius2[random(0, radius2.length - 1)],
borderTopRightRadius: radius1[random(0, radius1.length - 1)],
borderBottomLeftRadius: radius1[random(0, radius1.length - 1)],
borderBottomRightRadius: radius1[random(0, radius1.length - 1)],
});
$(item).draggabilly({ containment: true });
$(item).on("dragStart", (e) => {
_index++;
$(item).css({ zIndex: _index });
});
});
},
};
document.addEventListener("DOMContentLoaded", () => {
// leavingContext.setTitleText();
leavingContext.setEmptyText();
leavingContext.getData();
});
/* 随机样式 */
let _index = 100;
const colors = [
"#dcc10c",
"#299bec",
"#ea5455",
"#7367f0",
"#32ccbb",
"#f6416c",
"#28c76f",
"#9f44d3",
"#f55555",
"#736efe",
"#e96d71",
"#de4313",
"#d939cd",
"#4c83ff",
"#f072b6",
"#c346c2",
"#5961f9",
"#fd6585",
"#465efb",
"#ffc600",
"#fa742b",
"#5151e5",
"#bb4e75",
"#e255cd",
"#63c549",
"#0ecdde",
"#f067b4",
"#f067b4",
"#ff9a9e",
"#1dd5de",
"#4facfe",
"#f093fb",
"#6fa3ef",
"#bc99c4",
"#46c47c",
"#f9bb3c",
"#e8583d",
"#f68e5f",
]; // 定义你的颜色数组
const random = (min, max) =>
Math.floor(Math.random() * (max - min + 1)) + min;
const $el = $(".joe_leaving-list");
const maxWidth = $el.width();
const maxHeight = $el.height();
const radius1 = [
"20px 300px",
"20px 400px",
"20px 500px",
"30px 300px",
"30px 400px",
"30px 500px",
"40px 300px",
"40px 400px",
"40px 500px",
];
const radius2 = [
"300px 20px",
"400px 20px",
"500px 20px",
"300px 30px",
"400px 30px",
"500px 30px",
"300px 40px",
"400px 40px",
"500px 40px",
];
$(".joe_leaving-list .item").each((index, item) => {
const zIndex = random(1, 99);
const background = colors[random(0, colors.length - 1)];
const width = Math.ceil($(item).width());
const height = Math.ceil($(item).height());
const top = random(0, maxHeight - height);
const left = random(0, maxWidth - width);
$(item).css({
display: "block",
zIndex,
background,
top,
left,
borderTopLeftRadius: radius2[random(0, radius2.length - 1)],
borderTopRightRadius: radius1[random(0, radius1.length - 1)],
borderBottomLeftRadius: radius1[random(0, radius1.length - 1)],
borderBottomRightRadius: radius1[random(0, radius1.length - 1)],
});
$(item).draggabilly({ containment: true });
$(item).on("dragStart", (e) => {
_index++;
$(item).css({ zIndex: _index });
});
});

View File

@ -1 +1 @@
(()=>{var o={getData:function(){var e=$(".joe_detail__title").attr("data-sheetid"),t=$(".joe_leaving-list"),a=$(".joe_leaving-none"),n=$(".joe_loading");Utils.request({url:"/api/content/sheets/".concat(e,"/comments/top_view"),method:"GET",data:{page:0,sort:"createTime,desc"}}).then(function(e){e.total?(e=e.content.reduce(function(e,t){t.content.trim()&&(a=marked(t.content).replace(/<img\ssrc[^>]*>/gm,"[图片内容]").replace(/bili\//g,"bili/hd/ic_emoji_"),a=Utils.renderedEmojiHtml(a),t.content=Utils.return2Br(a));var a="".concat(ThemeConfig_gravatar_source||ThemeConfig_gravatar_source_url,"/").concat(t.gravatarMd5,"?s=256&d=").concat(ThemeConfig_gravatar_type);return e+'<li class="item">\n <div class="user">\n <img class="avatar lazyload" src="'.concat(ThemeConfig_lazyload_avatar,'" data-src="').concat(a,'" alt="用户头像" onerror="Joe.errorImg(this,').concat(ThemeConfig_comment_avatar_error,')"/>\n <div class="nickname">').concat(t.author,'</div>\n <div class="date">').concat(new Date(t.createTime).toLocaleDateString(),'</div>\n </div>\n <div class="wrapper">\n <div class="content leaving-content">').concat(t.content,"</div>\n </div>\n </li>")},""),t.html(e),o.randomColor()):(t.hide(),a.show()),n&&n.hide()}).catch(function(e){n&&n.hide(),t.hide(),a.show()})},setEmptyText:function(){$(".joe_leaving-none.tpl").length&&ThemeConfig_leaving_empty_text&&"暂无留言,期待第一个脚印。"!==ThemeConfig_leaving_empty_text.trim()&&$(".joe_leaving-none").text(ThemeConfig_leaving_empty_text)},randomColor:function(){function i(e,t){return Math.floor(Math.random()*(t-e+1))+e}var r=100,d=["#dcc10c","#299bec","#ea5455","#7367f0","#32ccbb","#f6416c","#28c76f","#9f44d3","#f55555","#736efe","#e96d71","#de4313","#d939cd","#4c83ff","#f072b6","#c346c2","#5961f9","#fd6585","#465efb","#ffc600","#fa742b","#5151e5","#bb4e75","#e255cd","#63c549","#0ecdde","#f067b4","#f067b4","#ff9a9e","#1dd5de","#4facfe","#f093fb","#6fa3ef","#bc99c4","#46c47c","#f9bb3c","#e8583d","#f68e5f"],e=$(".joe_leaving-list"),l=e.width(),p=e.height(),f=["20px 300px","20px 400px","20px 500px","30px 300px","30px 400px","30px 500px","40px 300px","40px 400px","40px 500px"],s=["300px 20px","400px 20px","500px 20px","300px 30px","400px 30px","500px 30px","300px 40px","400px 40px","500px 40px"];$(".joe_leaving-list .item").each(function(e,t){var a=i(1,99),n=d[i(0,d.length-1)],o=Math.ceil($(t).width()),c=Math.ceil($(t).height()),c=i(0,p-c),o=i(0,l-o);$(t).css({display:"block",zIndex:a,background:n,top:c,left:o,borderTopLeftRadius:s[i(0,s.length-1)],borderTopRightRadius:f[i(0,f.length-1)],borderBottomLeftRadius:f[i(0,f.length-1)],borderBottomRightRadius:f[i(0,f.length-1)]}),$(t).draggabilly({containment:!0}),$(t).on("dragStart",function(e){r++,$(t).css({zIndex:r})})})}};document.addEventListener("DOMContentLoaded",function(){o.setEmptyText(),o.getData()})})();
let _index=100;const colors=["#dcc10c","#299bec","#ea5455","#7367f0","#32ccbb","#f6416c","#28c76f","#9f44d3","#f55555","#736efe","#e96d71","#de4313","#d939cd","#4c83ff","#f072b6","#c346c2","#5961f9","#fd6585","#465efb","#ffc600","#fa742b","#5151e5","#bb4e75","#e255cd","#63c549","#0ecdde","#f067b4","#f067b4","#ff9a9e","#1dd5de","#4facfe","#f093fb","#6fa3ef","#bc99c4","#46c47c","#f9bb3c","#e8583d","#f68e5f"],random=(d,e)=>Math.floor(Math.random()*(e-d+1))+d,$el=$(".joe_leaving-list"),maxWidth=$el.width(),maxHeight=$el.height(),radius1=["20px 300px","20px 400px","20px 500px","30px 300px","30px 400px","30px 500px","40px 300px","40px 400px","40px 500px"],radius2=["300px 20px","400px 20px","500px 20px","300px 30px","400px 30px","500px 30px","300px 40px","400px 40px","500px 40px"];$(".joe_leaving-list .item").each((d,e)=>{var a=random(1,99),x=colors[random(0,colors.length-1)],p=Math.ceil($(e).width()),i=Math.ceil($(e).height()),i=random(0,maxHeight-i),p=random(0,maxWidth-p);$(e).css({display:"block",zIndex:a,background:x,top:i,left:p,borderTopLeftRadius:radius2[random(0,radius2.length-1)],borderTopRightRadius:radius1[random(0,radius1.length-1)],borderBottomLeftRadius:radius1[random(0,radius1.length-1)],borderBottomRightRadius:radius1[random(0,radius1.length-1)]}),$(e).draggabilly({containment:!0}),$(e).on("dragStart",d=>{_index++,$(e).css({zIndex:_index})})});

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="https://www.thymeleaf.org">
<th:block th:fragment="pageSetting">
<script th:inline="javascript" id="theme-config-getter">
const PageAttrs = {
enable_read_limit: /*[[${#annotations.getOrDefault(singlePage, 'enable_read_limit', 'false')}]]*/ false,
enable_page_meta: /*[[${#annotations.getOrDefault(singlePage, 'enable_page_meta','true')}]]*/ true,
enable_passage_tips: /*[[${#annotations.getOrDefault(singlePage, 'enable_passage_tips', 'true')}]]*/ true,
enable_collect_check: /*[[${#annotations.getOrDefault(singlePage, 'enable_collect_check', 'true')}]]*/ true,
use_raw_content: /*[[${#annotations.getOrDefault(singlePage, 'use_raw_content', 'true')}]]*/ false,
enable_comment: /*[[${#annotations.getOrDefault(singlePage, 'enable_comment', 'true')}]]*/ true,
enable_toc: /*[[${#annotations.getOrDefault(singlePage, 'enable_comment', 'true')}]]*/ true,
toc_depth: /*[[${#annotations.getOrDefault(singlePage, 'toc_depth', 0)}]]*/ 0,
img_max_width: /*[[${#annotations.getOrDefault(singlePage, 'img_max_width', '100%')}]]*/ '100%',
img_align: /*[[${#annotations.getOrDefault(singlePage, 'img_align', 'center')}]]*/ 'center',
enable_copy: /*[[${#annotations.getOrDefault(singlePage, 'enable_copy', 'true')}]]*/ true,
enable_donate: /*[[${#annotations.getOrDefault(singlePage, 'enable_donate', 'true')}]]*/ true,
enable_share: /*[[${#annotations.getOrDefault(singlePage, 'enable_share', 'true')}]]*/ true,
enable_like: /*[[${#annotations.getOrDefault(singlePage, 'enable_like', 'true')}]]*/ true,
enable_fold_long_code: /*[[${#annotations.getOrDefault(singlePage, 'enable_fold_long_code', 'true')}]]*/ true
};
</script>
</th:block>
</html>

View File

@ -1,10 +1,103 @@
<!DOCTYPE html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{layout :: html(head = null,content = ~{::content})}"
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layout :: html(title = ${site.title},htmlType = sheet,header = null,leftSidebar = true,content = ~{::content}, head = null, footer = null)}"
>
<th:block th:fragment="content">
<h1 th:text="${singlePage.spec.title}"></h1>
<article th:utext="${singlePage.content.content}"></article>
<th:block th:fragment="content">
<body>
<div id="Joe">
<th:block th:replace="~{modules/macro/navbar :: navbar}" />
<div class="joe_container joe_main_container page-sheet"
th:classappend="|${theme.config.theme.enable_show_in_up ? 'animated showInUp':''} ${theme.config.aside.aside_position == 'left' ? 'revert':''}|">
<div class="joe_main">
<div class="joe_detail" th:with="contributor = ${contributorFinder.getContributor(singlePage.status.contributors[0])}">
<h1 class="joe_detail__title"
th:classappend="${theme.config.post.enable_title_shadow ? 'txt-shadow':''}">[[${singlePage.spec.title}]]</h1>
<th:block th:if="${theme.config.post.enable_page_meta} and ${#annotations.getOrDefault(singlePage, 'enable_page_meta', 'true')}">
<div class="joe_detail__count">
<div class="joe_detail__count-information">
<img width="35" height="35" class="avatar lazyload" th:src="${theme.config.blogger.lazyload_avatar}" th:data-src="${contributor.avatar}" th:alt="${contributor.displayName}">
<div class="meta">
<div class="author">
<a class="link" th:href="${contributor.permalink}" th:title="${contributor.displayName}">[[${contributor.displayName}]]</a>
</div>
<div class="item">
<span class="text">[[${#dates.format(singlePage.spec.publishTime,'yyyy-MM-dd')}]]</span>
<span class="line">/</span>
<span class="text">[[${singlePage.stats.comment}]] 评论</span>
<span class="line">/</span>
<span class="text" >[[${singlePage.stats.visit}]] 阅读</span>
<span class="line">/</span>
<th:block th:with="wordCount = ${#strings.length(singlePage.content.content)}">
<span class="text">[[${wordCount}]] 字</span>
</th:block>
<th:block th:if="${#annotations.getOrDefault(singlePage, 'enable_collect_check', 'true')} and ${theme.config.other.check_baidu_collect}">
<span class="line">/</span>
<span class="text" id="joe_baidu_record">正在检测是否收录...</span>
</th:block>
</div>
</div>
</div>
<time class="joe_detail__count-created" th:datetime="${#dates.format(singlePage.spec.publishTime,'MM/dd')}">[[${#dates.format(singlePage.spec.publishTime,'MM/dd')}]]</time>
</div>
</th:block>
<article th:class="'joe_detail__article animated fadeIn '+${#annotations.getOrDefault(singlePage, 'img_align', 'center')+'-img'}"
th:classappend="|${#annotations.getOrDefault(singlePage, 'enable_read_limit', 'false') == 'true' ?'limited': ''} ${(#annotations.getOrDefault(singlePage, 'enable_copy', 'true') == 'false' or theme.config.post.enable_copy != true) ? 'uncopy' : ''} ${theme.config.post.enable_indent ? 'indent':''} ${(theme.config.post.enable_code_line_number == true and theme.config.post.enable_code_newline ==true) ? 'line-numbers':''} ${theme.config.post.enable_single_code_select == true ? 'single_code_select': ''}|">
<div id="singlePage-inner">
<th:block th:if="${#annotations.getOrDefault(singlePage, 'use_raw_content', 'false') == 'false'}">
<th:block th:utext="${singlePage.content.content}"></th:block>
</th:block>
<th:block th:if="${#annotations.getOrDefault(singlePage, 'use_raw_content', 'false') =='true'}">
<joe-raw-content>
<div id="_raw">[[${singlePage.content.content}]]</div>
</joe-raw-content>
</th:block>
</div>
<th:block th:if="${#annotations.getOrDefault(singlePage, 'enable_read_limit', 'false') == 'true'}">
<joe-read-limited></joe-read-limited>
</th:block>
</article>
</div>
<th:block th:if="${theme.config.other.enable_clean_mode != true} and ${theme.config.post.enable_comment}">
<div class="joe_comment">
<th:block th:if="${#annotations.getOrDefault(singlePage, 'enable_comment', 'true') != 'true'}">
<div class="joe_comment__close">
<svg class="joe_comment__close-icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
<path d="M512.307.973c282.317 0 511.181 201.267 511.181 449.587a402.842 402.842 0 0 1-39.27 173.26 232.448 232.448 0 0 0-52.634-45.977c16.384-39.782 25.293-82.688 25.293-127.283 0-211.098-199.117-382.157-444.621-382.157-245.555 0-444.57 171.06-444.57 382.157 0 133.427 79.514 250.88 200.039 319.18v107.982l102.041-65.127a510.157 510.157 0 0 0 142.49 20.122l19.405-.359c19.405-.716 38.758-2.508 57.958-5.427l3.584 13.415a230.607 230.607 0 0 0 22.323 50.688l-20.633 3.328a581.478 581.478 0 0 1-227.123-12.288L236.646 982.426c-19.66 15.001-35.635 7.168-35.635-17.664v-157.39C79.411 725.198 1.024 595.969 1.024 450.56 1.024 202.24 229.939.973 512.307.973zm318.464 617.011c97.485 0 176.794 80.435 176.794 179.2S928.256 976.23 830.77 976.23c-97.433 0-176.742-80.281-176.742-179.046 0-98.816 79.309-179.149 176.742-179.149zM727.757 719.002a131.174 131.174 0 0 0-25.754 78.182c0 71.885 57.805 130.406 128.768 130.406 28.877 0 55.552-9.625 77.056-26.01zm103.014-52.327c-19.712 0-39.117 4.557-56.678 13.312L946.33 854.58c8.499-17.305 13.158-36.864 13.158-57.395 0-71.987-57.805-130.509-128.717-130.509zM512.307 383.13l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072 67.072 67.072 0 0 1 66.662-67.43zm266.752 0l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072h-.051l.307-6.86a67.072 67.072 0 0 1 66.406-60.57zm-533.504 0l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072 67.072 67.072 0 0 1 66.662-67.43z" />
</svg>
<span>博主关闭了当前页面的评论</span>
</div>
</th:block>
<th:block th:if="${#annotations.getOrDefault(singlePage, 'enable_comment', 'true') == 'true'}">
<th:block th:replace="~{modules/macro/comment :: comment(name=${singlePage.metadata.name}, kind='SinglePage')}" />
</th:block>
</div>
</th:block>
<th:block th:if="${theme.config.other.enable_clean_mode == true} or ${theme.config.post.enable_comment !=true}">
<div class="joe_comment">
<div class="joe_comment__close">
<svg class="joe_comment__close-icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
<path d="M512.307.973c282.317 0 511.181 201.267 511.181 449.587a402.842 402.842 0 0 1-39.27 173.26 232.448 232.448 0 0 0-52.634-45.977c16.384-39.782 25.293-82.688 25.293-127.283 0-211.098-199.117-382.157-444.621-382.157-245.555 0-444.57 171.06-444.57 382.157 0 133.427 79.514 250.88 200.039 319.18v107.982l102.041-65.127a510.157 510.157 0 0 0 142.49 20.122l19.405-.359c19.405-.716 38.758-2.508 57.958-5.427l3.584 13.415a230.607 230.607 0 0 0 22.323 50.688l-20.633 3.328a581.478 581.478 0 0 1-227.123-12.288L236.646 982.426c-19.66 15.001-35.635 7.168-35.635-17.664v-157.39C79.411 725.198 1.024 595.969 1.024 450.56 1.024 202.24 229.939.973 512.307.973zm318.464 617.011c97.485 0 176.794 80.435 176.794 179.2S928.256 976.23 830.77 976.23c-97.433 0-176.742-80.281-176.742-179.046 0-98.816 79.309-179.149 176.742-179.149zM727.757 719.002a131.174 131.174 0 0 0-25.754 78.182c0 71.885 57.805 130.406 128.768 130.406 28.877 0 55.552-9.625 77.056-26.01zm103.014-52.327c-19.712 0-39.117 4.557-56.678 13.312L946.33 854.58c8.499-17.305 13.158-36.864 13.158-57.395 0-71.987-57.805-130.509-128.717-130.509zM512.307 383.13l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072 67.072 67.072 0 0 1 66.662-67.43zm266.752 0l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072h-.051l.307-6.86a67.072 67.072 0 0 1 66.406-60.57zm-533.504 0l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072 67.072 67.072 0 0 1 66.662-67.43z" />
</svg>
<span>博主关闭了所有页面的评论</span>
</div>
</div>
</th:block>
</div>
<th:block th:if="${theme.config.aside.enable_sheet_aside}">
<th:block th:replace="~{modules/common/aside :: aside}" />
</th:block>
</div>
<!-- action-->
<th:block th:replace="~{modules/common/actions :: actions}" />
<th:block th:replace="~{modules/common/footer :: footer}" />
</div>
<th:block th:replace="~{modules/macro/tail :: tail}" />
</body>
</th:block>
</html>

107
templates/page_leaving.html Normal file
View File

@ -0,0 +1,107 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layout :: html(title = ${site.title},htmlType = sheet,header = null,leftSidebar = true,content = ~{::content}, head = null, footer = null)}"
>
<th:block th:fragment="content">
<body>
<div id="Joe">
<th:block th:replace="~{modules/macro/navbar :: navbar}" />
<div class="joe_container joe_main_container page-sheet"
th:classappend="|${theme.config.theme.enable_show_in_up ? 'animated showInUp':''} ${theme.config.aside.aside_position == 'left' ? 'revert':''}|">
<div class="joe_main">
<div class="joe_detail" th:with="contributor = ${contributorFinder.getContributor(singlePage.status.contributors[0])}">
<h1 class="joe_detail__title"
th:classappend="${theme.config.post.enable_title_shadow ? 'txt-shadow':''}">[[${singlePage.spec.title}]]</h1>
<th:block th:if="${theme.config.post.enable_page_meta} and ${#annotations.getOrDefault(singlePage, 'enable_page_meta', 'true')}">
<div class="joe_detail__count">
<div class="joe_detail__count-information">
<img width="35" height="35" class="avatar lazyload" th:src="${theme.config.blogger.lazyload_avatar}" th:data-src="${contributor.avatar}" th:alt="${contributor.displayName}">
<div class="meta">
<div class="author">
<a class="link" th:href="${contributor.permalink}" th:title="${contributor.displayName}">[[${contributor.displayName}]]</a>
</div>
<div class="item">
<span class="text">[[${#dates.format(singlePage.spec.publishTime,'yyyy-MM-dd')}]]</span>
<span class="line">/</span>
<span class="text">[[${singlePage.stats.comment}]] 评论</span>
<span class="line">/</span>
<span class="text" >[[${singlePage.stats.visit}]] 阅读</span>
<span class="line">/</span>
<th:block th:with="wordCount = ${#strings.length(singlePage.content.content)}">
<span class="text">[[${wordCount}]] 字</span>
</th:block>
<th:block th:if="${#annotations.getOrDefault(singlePage, 'enable_collect_check', 'true')} and ${theme.config.other.check_baidu_collect}">
<span class="line">/</span>
<span class="text" id="joe_baidu_record">正在检测是否收录...</span>
</th:block>
</div>
</div>
</div>
<time class="joe_detail__count-created" th:datetime="${#dates.format(singlePage.spec.publishTime,'MM/dd')}">[[${#dates.format(singlePage.spec.publishTime,'MM/dd')}]]</time>
</div>
</th:block>
<article th:class="'joe_detail__article animated fadeIn '+${#annotations.getOrDefault(singlePage, 'img_align', 'center')+'-img'}"
th:classappend="|${#annotations.getOrDefault(singlePage, 'enable_read_limit', 'false') == 'true' ?'limited': ''} ${(#annotations.getOrDefault(singlePage, 'enable_copy', 'true') == 'false' or theme.config.post.enable_copy != true) ? 'uncopy' : ''} ${theme.config.post.enable_indent ? 'indent':''} ${(theme.config.post.enable_code_line_number == true and theme.config.post.enable_code_newline ==true) ? 'line-numbers':''} ${theme.config.post.enable_single_code_select == true ? 'single_code_select': ''}|">
<div class="joe_leaving tpl">
<ul class="joe_leaving-list">
<li th:each="result : ${commentFinder.list(null,1,20)}" class="item">
<div class="user">
<img class="avatar lazyload" th:src="${result.owner.avatar}" alt="用户头像"
th:data-src="${result.owner.avatar}" />
<div class="nickname" th:text="${result.spec.owner.displayName}"></div>
<div class="date" th:text="${#dates.format(result.metadata.creationTimestamp, 'yyyy-MM-dd')}"></div>
</div>
<div class="wrapper">
<div class="content leaving-content" th:utext="${result.spec.content}"></div>
</div>
</li>
</ul>
<div class="joe_leaving-none tpl">暂无留言,期待第一个脚印。</div>
</div>
</article>
</div>
<th:block th:if="${theme.config.other.enable_clean_mode != true} and ${theme.config.post.enable_comment}">
<div class="joe_comment">
<th:block th:if="${#annotations.getOrDefault(singlePage, 'enable_comment', 'true') != 'true'}">
<div class="joe_comment__close">
<svg class="joe_comment__close-icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
<path d="M512.307.973c282.317 0 511.181 201.267 511.181 449.587a402.842 402.842 0 0 1-39.27 173.26 232.448 232.448 0 0 0-52.634-45.977c16.384-39.782 25.293-82.688 25.293-127.283 0-211.098-199.117-382.157-444.621-382.157-245.555 0-444.57 171.06-444.57 382.157 0 133.427 79.514 250.88 200.039 319.18v107.982l102.041-65.127a510.157 510.157 0 0 0 142.49 20.122l19.405-.359c19.405-.716 38.758-2.508 57.958-5.427l3.584 13.415a230.607 230.607 0 0 0 22.323 50.688l-20.633 3.328a581.478 581.478 0 0 1-227.123-12.288L236.646 982.426c-19.66 15.001-35.635 7.168-35.635-17.664v-157.39C79.411 725.198 1.024 595.969 1.024 450.56 1.024 202.24 229.939.973 512.307.973zm318.464 617.011c97.485 0 176.794 80.435 176.794 179.2S928.256 976.23 830.77 976.23c-97.433 0-176.742-80.281-176.742-179.046 0-98.816 79.309-179.149 176.742-179.149zM727.757 719.002a131.174 131.174 0 0 0-25.754 78.182c0 71.885 57.805 130.406 128.768 130.406 28.877 0 55.552-9.625 77.056-26.01zm103.014-52.327c-19.712 0-39.117 4.557-56.678 13.312L946.33 854.58c8.499-17.305 13.158-36.864 13.158-57.395 0-71.987-57.805-130.509-128.717-130.509zM512.307 383.13l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072 67.072 67.072 0 0 1 66.662-67.43zm266.752 0l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072h-.051l.307-6.86a67.072 67.072 0 0 1 66.406-60.57zm-533.504 0l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072 67.072 67.072 0 0 1 66.662-67.43z" />
</svg>
<span>博主关闭了当前页面的评论</span>
</div>
</th:block>
<th:block th:if="${#annotations.getOrDefault(singlePage, 'enable_comment', 'true') == 'true'}">
<th:block th:replace="~{modules/macro/comment :: comment(name=${singlePage.metadata.name}, kind='SinglePage')}" />
</th:block>
</div>
</th:block>
<th:block th:if="${theme.config.other.enable_clean_mode == true} or ${theme.config.post.enable_comment !=true}">
<div class="joe_comment">
<div class="joe_comment__close">
<svg class="joe_comment__close-icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="18" height="18">
<path d="M512.307.973c282.317 0 511.181 201.267 511.181 449.587a402.842 402.842 0 0 1-39.27 173.26 232.448 232.448 0 0 0-52.634-45.977c16.384-39.782 25.293-82.688 25.293-127.283 0-211.098-199.117-382.157-444.621-382.157-245.555 0-444.57 171.06-444.57 382.157 0 133.427 79.514 250.88 200.039 319.18v107.982l102.041-65.127a510.157 510.157 0 0 0 142.49 20.122l19.405-.359c19.405-.716 38.758-2.508 57.958-5.427l3.584 13.415a230.607 230.607 0 0 0 22.323 50.688l-20.633 3.328a581.478 581.478 0 0 1-227.123-12.288L236.646 982.426c-19.66 15.001-35.635 7.168-35.635-17.664v-157.39C79.411 725.198 1.024 595.969 1.024 450.56 1.024 202.24 229.939.973 512.307.973zm318.464 617.011c97.485 0 176.794 80.435 176.794 179.2S928.256 976.23 830.77 976.23c-97.433 0-176.742-80.281-176.742-179.046 0-98.816 79.309-179.149 176.742-179.149zM727.757 719.002a131.174 131.174 0 0 0-25.754 78.182c0 71.885 57.805 130.406 128.768 130.406 28.877 0 55.552-9.625 77.056-26.01zm103.014-52.327c-19.712 0-39.117 4.557-56.678 13.312L946.33 854.58c8.499-17.305 13.158-36.864 13.158-57.395 0-71.987-57.805-130.509-128.717-130.509zM512.307 383.13l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072 67.072 67.072 0 0 1 66.662-67.43zm266.752 0l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072h-.051l.307-6.86a67.072 67.072 0 0 1 66.406-60.57zm-533.504 0l6.861.358a67.072 67.072 0 0 1 59.853 67.072l-.307 6.86a67.072 67.072 0 0 1-66.407 60.57l-6.81-.358a67.072 67.072 0 0 1-59.852-67.072 67.072 67.072 0 0 1 66.662-67.43z" />
</svg>
<span>博主关闭了所有页面的评论</span>
</div>
</div>
</th:block>
</div>
<th:block th:if="${theme.config.aside.enable_sheet_aside} and ${#annotations.getOrDefault(singlePage, 'enable_aside', 'true') == 'true'}">
<th:block th:replace="~{modules/common/aside :: aside}" />
</th:block>
</div>
<th:block th:replace="~{modules/common/actions :: actions}" />
<th:block th:replace="~{modules/common/footer :: footer}" />
</div>
<th:block th:replace="~{modules/macro/tail :: tail}" />
[[${singlePage.metadata.name}]]
</body>
</th:block>
</html>