From 421914a7e57cc642cc4acf5809353c3bfec5c954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E6=B3=A5?= Date: 2026年1月22日 20:03:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=AF=86=E7=A0=81=E4=BF=9D=E6=8A=A4?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E6=A0=87=E9=A2=98=E6=AD=A3=E5=B8=B8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 密码保护文章标题正常显示 --- post.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/post.php b/post.php index e994464..6e30e37 100755 --- a/post.php +++ b/post.php @@ -17,7 +17,7 @@
categories[0]; ?> -

title() ?>

+

hidden ? '密码保护:' . $this->row['title'] : $this->row['title']; ?>

date('Y.m.d'); ?> / @@ -39,7 +39,7 @@
-

title();?>

+

hidden ? '密码保护:' . $this->row['title'] : $this->row['title'];?>

阅读 commentsNum('评论 0', '评论 1', '评论 %d'); ?> 发表于date('Y.m.d'); ?> @@ -57,7 +57,7 @@
-

title() ?>

+

hidden ? '密码保护:' . $this->row['title'] : $this->row['title']; ?>

date('Y年m月d日'); ?> 阅读 From 82ea163d471f2024c303b91199df9e1784f1fff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E6=B3=A5?= Date: 2026年1月22日 20:06:30 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=AF=86=E7=A0=81=E4=BF=9D=E6=8A=A4?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E6=A0=87=E9=A2=98=E6=AD=A3=E5=B8=B8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 密码保护文章标题正常显示 --- index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 9b4fa56..98c32cd 100755 --- a/index.php +++ b/index.php @@ -41,7 +41,7 @@ $posts[] = [ 'link' => $post->permalink, - 'title' => $post->title, + 'title' => $post->hidden ? '密码保护:' . $post->row['title'] : $post->row['title'], 'thumb' => $thumbnail, ]; } @@ -107,7 +107,7 @@ next()): ?>

- title();?> + hidden ? '密码保护:' . $this->row['title'] : $this->row['title'];?>

excerpt(80,'...'); ?>

From 700b7d333fab8656d585a97a59586adc29fb5fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E6=B3=A5?= Date: 2026年1月22日 20:07:28 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=AF=86=E7=A0=81=E4=BF=9D=E6=8A=A4?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E6=A0=87=E9=A2=98=E6=AD=A3=E5=B8=B8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 密码保护文章标题正常显示 --- archives.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archives.php b/archives.php index df81fbb..6f88959 100755 --- a/archives.php +++ b/archives.php @@ -44,7 +44,7 @@ $articlesByYear[$year] = []; } $articlesByYear[$year][] = [ - 'title' => $archives->title, + 'title' => $archives->hidden ? '密码保护:' . $archives->row['title'] : $archives->row['title'], 'permalink' => $archives->permalink, 'date' => date('m月d日', $archives->created) ]; @@ -97,4 +97,4 @@
— END —
-need('footer.php'); ?> \ No newline at end of file +need('footer.php'); ?> From 997c65bc5494c60f9a7de2e58fd859c8d06b1599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E6=B3=A5?= Date: 2026年1月22日 20:08:21 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=AF=86=E7=A0=81=E4=BF=9D=E6=8A=A4?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E6=A0=87=E9=A2=98=E6=AD=A3=E5=B8=B8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 密码保护文章标题正常显示 --- header.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/header.php b/header.php index b8d9d36..83271eb 100644 --- a/header.php +++ b/header.php @@ -21,6 +21,9 @@ is('archive') && isset($this->request->year)): ?> request->year; ?>年发布的文章 - options->title(); ?> +is('post')): ?> +row['title']; ?> - options->title(); ?> + archiveTitle([ 'category' => _t('%s'), 'search' => _t('包含关键字 %s 的文章'), @@ -28,6 +31,7 @@ 'author' => _t('%s 发布的文章') ], '', ' - '); ?>options->title(); ?> + @@ -90,4 +94,4 @@
-
;"> \ No newline at end of file +
;"> From 8e514c26b936f983e223d8940db15865769072e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=BC=E5=B2=B8=E4=B8=B4=E7=AA=97?= <1895@88.com> Date: 2026年1月22日 21:25:27 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dajax=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E7=8A=B6=E6=80=81=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=92=8C=E5=88=A0=E9=99=A4=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=86=97=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archives.php | 13 +- footer.php | 3 +- functions.php | 37 +++-- static/js/comments.js | 321 ++++++++++++++++++++++-------------------- 4 files changed, 208 insertions(+), 166 deletions(-) diff --git a/archives.php b/archives.php index df81fbb..4287de0 100755 --- a/archives.php +++ b/archives.php @@ -19,9 +19,16 @@
diff --git a/footer.php b/footer.php index cee7dd5..042b054 100644 --- a/footer.php +++ b/footer.php @@ -3,8 +3,9 @@ - +
diff --git a/functions.php b/functions.php index 2308448..3afd749 100644 --- a/functions.php +++ b/functions.php @@ -1,7 +1,7 @@

OneBlog V

本主题精心打磨多年,且持续优化,现免费开源,致敬互联网社区开源精神,也致敬热爱生活和记录的我们。

-

使用教程请前往主题文档:docs.oneblog.net 获取,主题最新版本请前往Github仓库:OneBlog(最新)国内镜像仓库(延迟一天同步)查看,记得★Star,既是对作者的支持,也方便记住来时的路。本主题几乎所有代码都清晰地注释了,因此博友们完全可以以OneBlog为基础二次开发或单独开发属于自己的主题,但希望大家注明来源,保留基本的版权信息。

+

使用教程请前往主题文档:docs.oneblog.net 获取,主题最新版本请前往Github仓库:OneBlog(最新)国内镜像仓库(延迟一天同步)查看,记得★Star,既是对作者的支持,也方便记住来时的路。本主题几乎所有代码都清晰地注释了,因此博友们完全可以以OneBlog为基础二次开发或单独开发属于自己的主题,但希望大家注明来源,保留基本的版权信息。

本主题目前仅有QQ交流群:939170079,其他均不是官方群组,此外,还可以通过LiteBBS讨论交流。本主题的介绍、后续的更新或周边插件的开发更新,除了QQ群公告,还会同步发布在LiteBBS,欢迎大家参与讨论。

@@ -574,13 +574,30 @@ function showThumbnail($widget){ return; } -//挂载点赞路径 +//挂载点赞路径 + Ajax评论 function themeInit($archive) { - //评论点赞 + // 评论点赞 if ($archive->request->is("commentLike=dz")) { commentLikes($archive); } + // Ajax 评论 + if ($archive->request->isPost() && + !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && + strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') { + + Typecho_Plugin::factory('Widget_Feedback')->finishComment = function($comment) { + if (ob_get_length()) ob_clean(); + header('Content-Type: application/json; charset=UTF-8'); + + echo json_encode([ + 'success' => true, + 'message' => $comment->status === 'waiting' ? '评论提交成功,请等待审核' : '评论发表成功', + 'coid' => $comment->coid + ], JSON_UNESCAPED_UNICODE); + exit; + }; + } } //评论点赞 cookie保证点赞数量准确 @@ -736,11 +753,7 @@ function getMemosImages($coid) } /** - * 生成缩略图 URL: - * - 本地上传:原图名 + -s - * - COS/CDN:原图URL + 插件配置 cosThumbAppend(原样追加) - * - * 说明:不依赖 uploadMode,避免切换模式后影响历史图片。 + * 生成缩略图 URL */ function getMemosThumbUrl($url) { @@ -872,12 +885,13 @@ function oneblog_check_captcha($comment, $post, $result) { $options = Helper::options(); $user = Typecho_Widget::widget('Widget_User'); + // 已登录用户跳过验证 if ($user->hasLogin()) { return $comment; } /* ===== Cloudflare ===== */ - if (!empty($options->CFSiteKey) && !empty($options->CFSecret)) { + if (! empty($options->CFSiteKey) && !empty($options->CFSecret)) { if (empty($_POST['cf_token'])) { oneblog_abort('请先完成安全验证'); } @@ -896,7 +910,7 @@ function oneblog_check_captcha($comment, $post, $result) { } /* ===== Geetest ===== */ - if (!empty($options->GeetestID) && !empty($options->GeetestKEY)) { + if (! empty($options->GeetestID) && !empty($options->GeetestKEY)) { foreach (['lot_number','captcha_output','pass_token','gen_time'] as $k) { if (empty($_POST[$k])) { oneblog_abort('请完成极验验证'); @@ -939,6 +953,7 @@ function oneblog_check_captcha($comment, $post, $result) { Typecho_Plugin::factory('Widget_Feedback')->comment = 'oneblog_check_captcha'; + // 从分类描述中提取封面图片和文本描述 function CatInfo($description, $defaultImage = '') { // 设置默认图片路径 diff --git a/static/js/comments.js b/static/js/comments.js index f883c6a..2475d1d 100644 --- a/static/js/comments.js +++ b/static/js/comments.js @@ -1,9 +1,6 @@ /** - * Updated: 2026年01月21日 + * Updated: 2026年01月22日 * Author: ©彼岸临窗 oneblog.net - * - * 注释含命名规范,开源不易,如需引用请注明来源:彼岸临窗 https://oneblog.net。 - * 本主题已取得软件著作权(登记号:2025SR0334142)和外观设计专利(专利号:第7121519号),请严格遵循GPL-2.0协议使用本主题及源码。 */ document.addEventListener('DOMContentLoaded', function () { var commentList = document.querySelector('.comment-list'); @@ -14,29 +11,24 @@ document.addEventListener('DOMContentLoaded', function () { var loadingSpinner = document.getElementById('loading-spinner'); var noMoreElement = document.getElementById('no-more'); var loadMoreBtn = document.getElementById('load-more-comments'); - var isMobile = window.innerWidth <= 768; - // 如果是PC端,则显示加载按钮 - if (!isMobile && loadMoreBtn) { - loadMoreBtn.style.display = 'flex'; - loadMoreBtn.addEventListener('click', loadMoreComments); + function checkNoMore() { + var hasNext = document.querySelector('.page-navigator .next a'); + if (!hasNext) { + noMoreComments = true; + noMoreElement.style.display = 'flex'; + if (loadMoreBtn) loadMoreBtn.style.display = 'none'; + } + return ! hasNext; } function loadMoreComments() { if (isLoading || noMoreComments) return; - var nextPageUrl = document.querySelector('.page-navigator .next a')?.getAttribute('href'); - if (!nextPageUrl) { - noMoreComments = true; - noMoreElement.style.display = 'flex'; - if (loadMoreBtn) loadMoreBtn.style.display = 'none'; - return; - } + if (!nextPageUrl) return checkNoMore(); isLoading = true; - - // 开始加载:显示动画,隐藏按钮 if (loadingSpinner) loadingSpinner.style.display = 'flex'; if (loadMoreBtn) loadMoreBtn.style.display = 'none'; @@ -47,256 +39,283 @@ document.addEventListener('DOMContentLoaded', function () { if (xhr.status>= 200 && xhr.status < 400) { var tempDiv = document.createElement('div'); tempDiv.innerHTML = xhr.responseText; - - var newComments = tempDiv.querySelector('.comment-list').innerHTML; - commentList.insertAdjacentHTML('beforeend', newComments); - - var newNav = tempDiv.querySelector('.page-navigator')?.innerHTML; - if (newNav) { - document.querySelector('.page-navigator').innerHTML = newNav; - } - - var hasNext = tempDiv.querySelector('.page-navigator .next a'); - if (!hasNext) { - noMoreComments = true; - noMoreElement.style.display = 'flex'; - if (loadMoreBtn) loadMoreBtn.style.display = 'none'; - } else { - if (loadMoreBtn) loadMoreBtn.style.display = 'flex'; - } - - } else { - console.error('Request failed: ' + xhr.statusText); - if (loadMoreBtn) loadMoreBtn.style.display = 'flex'; + commentList.insertAdjacentHTML('beforeend', tempDiv.querySelector('.comment-list').innerHTML); + var newNav = tempDiv.querySelector('.page-navigator')?. innerHTML; + if (newNav) document.querySelector('.page-navigator').innerHTML = newNav; + if (! checkNoMore() && loadMoreBtn) loadMoreBtn.style.display = 'flex'; + } else if (loadMoreBtn) { + loadMoreBtn.style.display = 'flex'; } - isLoading = false; if (loadingSpinner) loadingSpinner.style.display = 'none'; }; - xhr.onerror = function () { - console.error('Request failed'); isLoading = false; if (loadingSpinner) loadingSpinner.style.display = 'none'; if (loadMoreBtn) loadMoreBtn.style.display = 'flex'; }; - xhr.send(); }, 500); } - // 移动端采用滚动自动加载 + if (! isMobile && loadMoreBtn) { + loadMoreBtn.style.display = 'flex'; + loadMoreBtn.addEventListener('click', loadMoreComments); + } + if (isMobile) { window.addEventListener('scroll', function () { if (isLoading || noMoreComments) return; - var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; - var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; + var scrollHeight = document.documentElement.scrollHeight || document.body. scrollHeight; var clientHeight = document.documentElement.clientHeight || document.body.clientHeight; - - if (scrollTop + clientHeight>= scrollHeight - 200) { - loadMoreComments(); - } + if (scrollTop + clientHeight>= scrollHeight - 200) loadMoreComments(); }); } - // 初始检查是否还有下一页 - var initialNextPageUrl = document.querySelector('.page-navigator .next a')?.getAttribute('href'); - if (!initialNextPageUrl) { - noMoreComments = true; - noMoreElement.style.display = 'flex'; - if (loadMoreBtn) loadMoreBtn.style.display = 'none'; - } + checkNoMore(); }); - -/** 回复时替换表单标题 20250602**/ +/** 回复标题切换 **/ document.addEventListener('DOMContentLoaded', function() { - var commentList = document.querySelector('.comment-list'); - if (!commentList) return; // 如果当前页面不存在评论,则不执行该JS - // 点击回复时 - document.querySelectorAll('.comment-reply').forEach(function(replyBtn) { - replyBtn.addEventListener('click', function() { - document.getElementById('reply-target').textContent = this.getAttribute('data-author'); + if (! document.querySelector('.comment-list')) return; + + document.addEventListener('click', function(e) { + var replyBtn = e.target.closest('.comment-reply'); + if (replyBtn) { + document.getElementById('reply-target').textContent = replyBtn.getAttribute('data-author'); document.getElementById('default-title').style.display = 'none'; document.getElementById('reply-title').style.display = ''; - }); + } }); - // 点击取消回复时 document.querySelector('.cancel-comment-reply a')?.addEventListener('click', function() { document.getElementById('reply-title').style.display = 'none'; document.getElementById('default-title').style.display = ''; }); }); -/** 新增 Cloudflare Turnstile 验证 20260115 ,可选择极验或CF验证或关闭验证**/ -/** Cloudflare Turnstile / Geetest Ajax 评论提交(最终增强版) **/ +/** Ajax 评论提交 **/ document.addEventListener('DOMContentLoaded', function () { - const form = document.getElementById('comment-form'); + const form = document. getElementById('comment-form'); const submitBtn = document.getElementById('geetest-submit-btn'); - if (!form || !submitBtn) return; + if (! form || !submitBtn) return; const textarea = document.getElementById('textarea'); const richEditor = document.getElementById('rich-editor'); - const cfSiteKeyInput = document.getElementById('cf-sitekey'); - const geetestIdInput = document.getElementById('geetest-captcha-id'); + const cfSiteKey = document.getElementById('cf-sitekey')?.value; + const geetestId = document.getElementById('geetest-captcha-id')?.value; - const cfEnabled = cfSiteKeyInput && cfSiteKeyInput.value; - const geetestEnabled = !cfEnabled && geetestIdInput && geetestIdInput.value; - - let hasSubmitted = false; + let submitting = false; let captchaObj = null; let gtReady = false; - const originText = submitBtn.innerText; - /* ===== 夜间模式 ===== */ - function isNightMode() { - return document.documentElement.classList.contains('night'); - } - - /* ===== 按钮状态控制 ===== */ - function setBtn(text, loading = false) { + function setBtn(text, loading) { submitBtn.innerHTML = '' + text; submitBtn.disabled = true; - submitBtn.classList.toggle('is-loading', loading); + submitBtn.classList. toggle('is-loading', loading); } - function resetBtn() { submitBtn.innerText = originText; submitBtn.disabled = false; submitBtn.classList.remove('is-loading'); + submitting = false; + } + + function extractText(html) { + const div = document.createElement('div'); + div.innerHTML = html; + div.querySelectorAll('script,style,noscript').forEach(el => el.remove()); + for (const sel of ['.container h1', '.container p', 'body h1', 'body p', 'pre']) { + const el = div. querySelector(sel); + const txt = el?. textContent?. trim(); + if (txt && txt.length < 300) return txt; + } + let text = (div.textContent || '').replace(/\s+/g, ' ').trim(); + return text. length> 150 ? text.substring(0, 150) + '...' : text; + } + + // 局部刷新评论列表 + function reloadComments(newCoid) { + fetch(location.href, { credentials: 'same-origin' }) + .then(res => res. text()) + .then(html => { + const doc = new DOMParser().parseFromString(html, 'text/html'); + + const newList = doc.querySelector('.comment-list'); + const oldList = document.querySelector('.comment-list'); + + if (newList) { + if (oldList) { + oldList.innerHTML = newList.innerHTML; + } else { + // 原本无评论,插入新列表 + const respond = document.querySelector('.respond'); + if (respond) { + respond. insertAdjacentHTML('afterend', '
    ' + newList.innerHTML + '
'); + } + } + } + + // 更新分页 + const newNav = doc.querySelector('.page-navigator'); + const oldNav = document.querySelector('.page-navigator'); + if (newNav && oldNav) oldNav.innerHTML = newNav.innerHTML; + + // 滚动到新评论并高亮 + if (newCoid) { + setTimeout(() => { + const el = document.getElementById('comment-' + newCoid); + if (el) { + el.classList.add('comment-new'); + el.scrollIntoView({ behavior: 'smooth', block: 'center' }); + setTimeout(() => el.classList.remove('comment-new'), 3000); + } + }, 100); + } + }) + .catch(() => location.reload()); } - /* ===== Ajax 提交 ===== */ function ajaxSubmit() { setBtn('提交中...', true); - const data = new FormData(form); - - fetch(form.action, { + fetch(form. action, { method: 'POST', - body: data, + body: new FormData(form), credentials: 'same-origin', headers: { 'X-Requested-With': 'XMLHttpRequest' } }) - .then(res => { - if (res.status === 302 || res.redirected) return { success: true }; + .then(res => res. text().then(text => ({ status: res.status, text }))) + .then(({ status, text }) => { + let json = null; + try { json = JSON.parse(text); } catch (e) {} - const ct = res.headers.get('content-type') || ''; - if (ct.includes('application/json')) return res.json(); + if (status>= 400) { + layer.msg(json?.message || extractText(text) || '请求失败(' + status + ')', { time: 3000 }); + resetBtn(); + return; + } - return { success: true }; - }) - .then(json => { - if (json.success) { - layer.msg('提交成功,请等待审核', { time: 1000 }); - setTimeout(() => location.reload(), 2000); - } else { - layer.msg(json.message || '提交失败'); - hasSubmitted = false; + if (json && json.success) { + layer.msg(json.message || '评论提交成功', { time: 2000 }); + textarea.value = ''; + if (richEditor) richEditor.innerHTML = ''; + document.querySelector('.cancel-comment-reply a')?.click(); + reloadComments(json.coid); + resetBtn(); + return; + } + + if (json && ! json.success) { + layer.msg(json.message || '提交失败', { time: 3000 }); resetBtn(); + return; + } + + const keywords = ['失败', '错误', '禁止', '拒绝', '不允许', '太快', '垃圾', '不合规','error', 'fail', 'spam']; + if (keywords.some(k => text.toLowerCase().includes(k))) { + layer.msg(extractText(text) || '提交失败', { time: 3000 }); + } else { + layer.msg('提交状态未知,正在刷新...', { time: 1500 }); + setTimeout(() => location.reload(), 1800); } + resetBtn(); }) .catch(() => { - layer.msg('网络错误,请稍后再试'); - hasSubmitted = false; + layer.msg('网络错误,请稍后重试', { time: 3000 }); resetBtn(); }); } - /* ===== Cloudflare Turnstile ===== */ function renderCF() { setBtn('等待验证...', true); - let wrap = document.getElementById('cf-rich-wrap'); if (!wrap) { - wrap = document.createElement('div'); + wrap = document. createElement('div'); wrap.id = 'cf-rich-wrap'; richEditor.after(wrap); } else { wrap.innerHTML = ''; } - turnstile.render(wrap, { - sitekey: cfSiteKeyInput.value, + sitekey: cfSiteKey, size: 'flexible', - theme: isNightMode() ? 'dark' : 'light', - callback: function (token) { + theme: document. documentElement.classList.contains('night') ? 'dark' : 'light', + callback: token => { let input = form.querySelector('[name="cf_token"]'); - if (!input) { + if (! input) { input = document.createElement('input'); - input.type = 'hidden'; + input. type = 'hidden'; input.name = 'cf_token'; - form.appendChild(input); + form. appendChild(input); } input.value = token; + setTimeout(() => { + if (wrap) { + wrap.remove(); + } + }, 2000); ajaxSubmit(); + }, + 'error-callback': () => { + layer.msg('验证加载失败,请刷新重试'); + resetBtn(); } }); } - /* ===== Geetest ===== */ - if (geetestEnabled) { - window.initGeetest4({ - captchaId: geetestIdInput.value, - product: 'bind' - }, function (obj) { + if (geetestId && !cfSiteKey) { + window.initGeetest4({ captchaId: geetestId, product: 'bind' }, obj => { captchaObj = obj; obj.onReady(() => gtReady = true); - obj.onSuccess(function () { + obj.onSuccess(() => { setBtn('提交中...', true); - const result = obj.getValidate(); Object.keys(result).forEach(k => { - let i = form.querySelector(`[name="${k}"]`); - if (!i) { - i = document.createElement('input'); - i.type = 'hidden'; - i.name = k; - form.appendChild(i); + let input = form.querySelector(`[name="${k}"]`); + if (! input) { + input = document.createElement('input'); + input.type = 'hidden'; + input.name = k; + form.appendChild(input); } - i.value = result[k]; + input.value = result[k]; }); - ajaxSubmit(); }); + obj.onError(() => { + layer.msg('验证组件出错,请刷新重试'); + resetBtn(); + }); }); } - /* ===== 提交入口 ===== */ submitBtn.addEventListener('click', function (e) { e.preventDefault(); - if (hasSubmitted) return; - hasSubmitted = true; + if (submitting) return; + submitting = true; - if (!textarea.value.trim()) { + if (! textarea.value.trim()) { layer.msg('评论内容不能为空'); - hasSubmitted = false; resetBtn(); return; } - if (cfEnabled) { + if (cfSiteKey) { renderCF(); - return; - } - - if (geetestEnabled) { - if (!captchaObj || !gtReady) { - layer.msg('验证组件加载中'); - hasSubmitted = false; + } else if (geetestId) { + if (! captchaObj || !gtReady) { + layer. msg('验证组件加载中,请稍后'); resetBtn(); return; } setBtn('等待验证...', true); captchaObj.showCaptcha(); - return; + } else { + ajaxSubmit(); } - - ajaxSubmit(); }); -}); - +}); \ No newline at end of file From ae1b87daf95ff76257d9dc1d19225628ce461676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=BC=E5=B2=B8=E4=B8=B4=E7=AA=97?= <1895@88.com> Date: 2026年2月11日 18:40:31 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=9B=B4=E8=BF=AD=E5=AF=BC=E8=87=B4=E7=9A=84=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archives.php | 10 +++++----- comments.php | 2 +- functions.php | 2 +- index.php | 6 +++--- links.php | 4 ++-- memos.php | 2 +- page.php | 6 +++--- photos.php | 4 ++-- post.php | 6 +++--- static/js/comments.js | 4 ++++ static/js/main.js | 4 ++-- 11 files changed, 27 insertions(+), 23 deletions(-) diff --git a/archives.php b/archives.php index 863eb84..84723b4 100755 --- a/archives.php +++ b/archives.php @@ -35,12 +35,12 @@

archiveTitle(' » ', ''); ?>Blog's Archives

-
+

title(); ?>

-
+
widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives); $articlesByYear = []; @@ -67,7 +67,7 @@
-
+

#页面

widget('Widget_Contents_Page_List')->to($pages); @@ -78,7 +78,7 @@
-
+

#分类

widget('Widget_Metas_Category_List')->to($categories); @@ -89,7 +89,7 @@
-
+

#标签

levels> 0 ? 'comment-child' : 'comment-parent';?> -
  • +
  • mail, ENT_QUOTES, 'UTF-8'); $imgUrl = getGravatar($email);echo ''; ?> diff --git a/functions.php b/functions.php index 3afd749..9a2f401 100644 --- a/functions.php +++ b/functions.php @@ -657,7 +657,7 @@ function commentLikes($archive){ // 微语数据加载 function MemosList($comments, $user) { ?> -
  • +
  • next()): ?> -

    +

    hidden ? '密码保护:' . $this->row['title'] : $this->row['title'];?>

    -
    +

    excerpt(80,'...'); ?>

    -
    +
    date); ?> 阅读 commentsNum('0 评论', '1 评论', '%d 评论'); ?> diff --git a/links.php b/links.php index d6bfcc3..c61406a 100755 --- a/links.php +++ b/links.php @@ -33,7 +33,7 @@

    archiveTitle(' » ', ''); ?>My online friends

    -
    +

    title(); ?>

    @@ -56,7 +56,7 @@ 暂未启用Links插件,请先安装并启用该插件。
    -
    +

    # 友链要求 diff --git a/memos.php b/memos.php index 7613611..efa6747 100755 --- a/memos.php +++ b/memos.php @@ -54,7 +54,7 @@

    -
    +
    comments()->to($comments); ?> have()) : ?>