Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
9d7495afbe
|
@ -3,7 +3,7 @@ var btf = {
|
|||
|
||||
|
||||
// 修改时间显示"最近"
|
||||
diffDate: function (d, more = false) {
|
||||
diffDateExact: function (d, more = false) {
|
||||
const dateNow = new Date();
|
||||
const datePost = new Date(d);
|
||||
const dateDiff = dateNow.getTime() - datePost.getTime();
|
||||
|
@ -265,11 +265,11 @@ var btf = {
|
|||
} else if (dayCount >= 1) {
|
||||
result = parseInt(dayCount) + '' + GLOBAL_CONFIG.date_suffix.day
|
||||
} else if (hourCount >= 1) {
|
||||
result = '最近'
|
||||
// result = parseInt(hourCount) + ' ' + GLOBAL_CONFIG.date_suffix.hour
|
||||
// result = '最近'
|
||||
result = parseInt(hourCount) + ' ' + GLOBAL_CONFIG.date_suffix.hour
|
||||
} else if (minuteCount >= 1) {
|
||||
result = '最近'
|
||||
// result = parseInt(minuteCount) + ' ' + GLOBAL_CONFIG.date_suffix.min
|
||||
// result = '最近'
|
||||
result = parseInt(minuteCount) + ' ' + GLOBAL_CONFIG.date_suffix.min
|
||||
} else {
|
||||
result = GLOBAL_CONFIG.date_suffix.just
|
||||
}
|
||||
|
|
|
@ -29,20 +29,20 @@ function HaoPostAI(AI_option) {
|
|||
post_ai_box.className = 'post-ai';
|
||||
post.insertBefore(post_ai_box, post.firstChild);
|
||||
|
||||
var PostAI = `
|
||||
var PostAI = `
|
||||
<div class="ai-title">
|
||||
<i class="haofont hao-icon-bilibili"></i>
|
||||
<div class="ai-title-text">${interface.name}</div>`
|
||||
if(switchBtn){
|
||||
PostAI = PostAI+ `<div id="ai-Toggle">${interface.aiToggle}</div> `;
|
||||
if (switchBtn) {
|
||||
PostAI += `<div id="ai-Toggle">${interface.aiToggle}</div> `;
|
||||
}
|
||||
PostAI = PostAI+ `<i class="haofont hao-icon-arrow-rotate-right"></i> `;
|
||||
if(modeName == 'local'){
|
||||
PostAI = PostAI+ `<div class="ai-tag" id="ai-tag">${gptName} GPT</div>`;
|
||||
}else{
|
||||
PostAI = PostAI+ `<div class="ai-tag" id="ai-tag">${interface.version}</div> `;
|
||||
PostAI += `<i class="haofont hao-icon-arrow-rotate-right"></i> `;
|
||||
if (modeName == 'local') {
|
||||
PostAI += `<div class="ai-tag" id="ai-tag">${gptName} GPT</div>`;
|
||||
} else {
|
||||
PostAI += `<div class="ai-tag" id="ai-tag">${interface.version}</div> `;
|
||||
}
|
||||
PostAI = PostAI+ `
|
||||
PostAI += `
|
||||
</div>
|
||||
<div class="ai-explanation" style="display: block;">AI初始化中...</div>
|
||||
<div class="ai-btn-box">
|
||||
|
@ -53,7 +53,7 @@ function HaoPostAI(AI_option) {
|
|||
<div class="ai-btn-item" id="go-tianli-blog">前往tianli博客</div>
|
||||
</div>`;
|
||||
|
||||
post_ai_box.innerHTML =PostAI;
|
||||
post_ai_box.innerHTML = PostAI;
|
||||
// 当前随机到的ai摘要到index
|
||||
let lastAiRandomIndex = -1;
|
||||
let animationRunning = true; // 标志变量,控制动画函数的运行
|
||||
|
@ -263,27 +263,35 @@ function HaoPostAI(AI_option) {
|
|||
|
||||
function recommendList() {
|
||||
let thumbnail = document.querySelectorAll('.relatedPosts-list a');
|
||||
var title = document.title;
|
||||
let list = '';
|
||||
let index = 0;
|
||||
if (!thumbnail.length) {
|
||||
const cardRecentPost = document.querySelector('.card-widget.card-recent-post');
|
||||
if (!cardRecentPost) return '';
|
||||
|
||||
thumbnail = cardRecentPost.querySelectorAll('.aside-list-item a');
|
||||
|
||||
let list = '';
|
||||
for (let i = 0; i < thumbnail.length; i++) {
|
||||
const item = thumbnail[i];
|
||||
list += `<div class="ai-recommend-item"><span class="index">${i + 1}:</span><a href="javascript:;" onclick="pjax.loadUrl('${item.href}')" title="${item.title}" data-pjax-state="">${item.title}</a></div>`;
|
||||
if(thumbnail.length>0){
|
||||
thumbnail.forEach(item => {
|
||||
if (item) {
|
||||
if(!title.includes(item.title)){
|
||||
index +=1;
|
||||
list += `<div class="ai-recommend-item"><span class="index">${i + 1}:</span><a href="javascript:;" onclick="pjax.loadUrl('${item.href}')" title="${item.title}" data-pjax-state="">${item.title}</a></div>`;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return `很抱歉,无法找到类似的文章,你也可以看看本站最新发布的文章:<br /><div class="ai-recommend">${list}</div>`;
|
||||
}
|
||||
|
||||
let list = '';
|
||||
for (let i = 0; i < thumbnail.length; i++) {
|
||||
const item = thumbnail[i];
|
||||
list += `<div class="ai-recommend-item"><span>推荐${i + 1}:</span><a href="javascript:;" onclick="pjax.loadUrl('${item.href}')" title="${item.title}" data-pjax-state="">${item.title}</a></div>`;
|
||||
}
|
||||
|
||||
thumbnail.forEach(item => {
|
||||
if (item) {
|
||||
if(!title.includes(item.title)){
|
||||
index +=1;
|
||||
list += `<div class="ai-recommend-item"><span>推荐${index}:</span><a href="javascript:;" onclick="pjax.loadUrl('${item.href}')" title="${item.title}" data-pjax-state="">${item.title}</a></div>`;
|
||||
}
|
||||
}
|
||||
});
|
||||
return `推荐文章:<br /><div class="ai-recommend">${list}</div>`;
|
||||
}
|
||||
|
||||
|
|
|
@ -9269,7 +9269,7 @@ canvas#universe {
|
|||
background: var(--heo-card-bg);
|
||||
border-radius: 8px;
|
||||
border: var(--style-border-always);
|
||||
font-size: 15px;
|
||||
font-size: 15.8px;
|
||||
line-height: 1.4;
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,24 @@
|
|||
<div class="card-widget card-recent-post" th:fragment="comments">
|
||||
<div class="item-headline"><i class="iconfont icon-comment-dots"></i><span>最新评论</span></div>
|
||||
<div class="aside-list" id="newcomm">
|
||||
<th:block th:if="${#strings.equals(theme.config.comments.use, 'commentWidget') }">
|
||||
<div class="aside-list-item" th:each="comment,iterStat : ${commentFinder.list(null, 1, 10)}" th:with="post = ${postFinder.getByName(comment.spec.subjectRef.name)}" th:if="${iterStat.index < 5}">
|
||||
<a class="thumbnail" th:href="${post.status.permalink + '#comment-' + comment.metadata.name}" data-pjax-state="">
|
||||
<img loading="lazy" alt="头像" th:src="${#strings.isEmpty(comment.owner.avatar)?'https://cravatar.cn/avatar/?d=mp':comment.owner.avatar}" data-ll-status="loading" class="entered loading">
|
||||
</a>
|
||||
<div class="content" >
|
||||
<a class="comment" style="display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;overflow: hidden;"
|
||||
th:href="${post.status.permalink + '#comment-' + comment.metadata.name}" th:title="${comment.spec.content}" th:text="${comment.spec.content}" data-pjax-state="">
|
||||
|
||||
</a>
|
||||
<div class="name">
|
||||
<span th:text="${comment.owner.displayName + ' / '}">stonewu / </span>
|
||||
<time th:datetime="${#dates.format(comment.metadata.creationTimestamp, 'yyyy-MM-dd HH:mm:ss')}"></time>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</th:block>
|
||||
|
||||
<script th:if="${theme.config.comments.twikooEnable && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.twikoos.envId)}">
|
||||
(()=>{
|
||||
const runTwikoo = () => {
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
|
||||
<th:block th:fragment="cardNewestComments">
|
||||
<!-- 最近评论 -->
|
||||
<script
|
||||
th:fragment="cardNewestComments"
|
||||
th:if="${theme.config.comments.twikooEnable && #strings.equals(theme.config.comments.use, 'Twikoo') && not #strings.isEmpty(theme.config.comments.twikoos.envId)}">
|
||||
<script
|
||||
th:if="${theme.config.comments.twikooEnable
|
||||
&& #strings.equals(theme.config.comments.use, 'Twikoo')
|
||||
&& not #strings.isEmpty(theme.config.comments.twikoos.envId)}">
|
||||
window.addEventListener('load', () => {
|
||||
const changeContent = (content) => {
|
||||
if (content === '') return content
|
||||
|
@ -96,4 +97,5 @@
|
|||
document.addEventListener('pjax:complete', newestCommentInit)
|
||||
})</script>
|
||||
|
||||
</th:block>
|
||||
</html>
|
|
@ -14,7 +14,29 @@
|
|||
<div class="author-content-item-tips">互动</div>
|
||||
<span class="author-content-item-title">最近评论</span>
|
||||
</div>
|
||||
<div class="aside-list"><span>正在加载中...</span></div>
|
||||
<div class="aside-list">
|
||||
<th:block th:if="${#strings.equals(theme.config.comments.use, 'commentWidget') }">
|
||||
<div class="aside-list-item" th:each="comment,iterStat : ${commentFinder.list(null, 1, 10)}" th:with="post = ${postFinder.getByName(comment.spec.subjectRef.name)}" th:if="${iterStat.index < 4}">
|
||||
<a th:href="${post.status.permalink + '#comment-' + comment.metadata.name}" class="thumbnail" data-pjax-state="">
|
||||
<img th:src="${#strings.isEmpty(comment.owner.avatar)?'https://cravatar.cn/avatar/?d=mp':comment.owner.avatar}"
|
||||
th:alt="${comment.owner.displayName}" data-ll-status="loaded" class="entered loaded">
|
||||
<div class="name"><span>stonewu</span></div>
|
||||
</a>
|
||||
<div class="content">
|
||||
<a class="comment" th:href="${post.status.permalink + '#comment-' + comment.metadata.name}" th:title="${comment.spec.content}" data-pjax-state="" th:text="${comment.spec.content}"></a>
|
||||
<time th:datetime="${#dates.format(comment.metadata.creationTimestamp, 'yyyy-MM-dd HH:mm:ss')}"></time>
|
||||
</div>
|
||||
</div>
|
||||
<script data-pjax>
|
||||
window.addEventListener('load', () => {
|
||||
$(".aside-list time").each(function () {
|
||||
var timeVal = $(this).attr("datetime");
|
||||
$(this).text(btf.diffDateExact(timeVal,true));
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</th:block>
|
||||
<span th:if="${#strings.equals(theme.config.comments.use, 'Twikoo') }">正在加载中...</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 右侧展示 tag -->
|
||||
|
@ -116,7 +138,7 @@
|
|||
</div>
|
||||
|
||||
<!-- 最近评论 -->
|
||||
<script th:replace="~{modules/widgets/cardNewestComments :: cardNewestComments}"></script>
|
||||
<th:block th:replace="~{modules/widgets/cardNewestComments :: cardNewestComments}"></th:block>
|
||||
</div>
|
||||
|
||||
</html>
|
|
@ -102,7 +102,7 @@
|
|||
</article>
|
||||
|
||||
<!-- 文章ai摘要 -->
|
||||
<script th:if="${theme.config.post.aiDescription.aiDescriptionEnable}" data-pjax defer>
|
||||
<script th:if="${theme.config.post.aiDescription.aiDescriptionEnable}" data-pjax >
|
||||
new HaoPostAI({
|
||||
ai: '[(${post.status.excerpt})]',
|
||||
randomNum: [[${ theme.config.post.aiDescription.randomNum }]], //按钮最大的随机次数,也就是一篇文章最大随机出来几种
|
||||
|
@ -151,7 +151,7 @@
|
|||
<div class="relatedPosts-list"
|
||||
th:with="recommandPosts = ${postFinder.listByCategory(1, theme.config.post.recommendQuantity, post.categories.get(0).metadata.name)}">
|
||||
<!-- 建议阅读,这里可以自定义文章数量,然后遍历展示 -->
|
||||
<div th:each="recommandPost :${recommandPosts}">
|
||||
<div th:each="recommandPost :${recommandPosts}" th:if="${not #strings.equals(post.spec.title, recommandPost.spec.title)}">
|
||||
<a th:href="@{${recommandPost.status.permalink}}" th:title="${recommandPost.spec.title}">
|
||||
<img alt="cover" class="cover" loading="lazy" id="preimg"
|
||||
th:src="${#strings.isEmpty(recommandPost.spec.cover) ? theme.config.layout.postRandomImg : recommandPost.spec.cover}">
|
||||
|
|
Loading…
Reference in New Issue