fix: 代码格式优化和临时文件清理

- 优化多个模板文件的代码格式

- 清理 tmp 目录中的临时备份文件

- 统一代码风格,符合项目规范
This commit is contained in:
User
2026-03-13 18:53:06 +08:00
parent 6ba6397ead
commit 7dbf574338
10 changed files with 715 additions and 37 deletions

View File

@@ -1441,9 +1441,9 @@ if (argonConfig.waterflow_columns != "1") {
}
}
}
if (commentLink != "" && !(/https?:\/\//).test(commentLink)) {
if (commentLink != "" && commentLink.indexOf('.') == -1) {
isError = true;
errorMsg += __("网站格式错误 (不是 http(s):// 开头)") + "</br>";
errorMsg += __("网站格式错误") + "</br>";
}
if (!$("#post_comment").hasClass("no-need-captcha")) {
// 检查是否使用Geetest验证码
@@ -1541,7 +1541,7 @@ if (argonConfig.waterflow_columns != "1") {
comment: commentContent,
author: commentName,
email: commentEmail,
url: commentLink,
url: (commentLink != "" && !(/^https?:\/\//).test(commentLink) && !(/^\/\//).test(commentLink)) ? ("http://" + commentLink) : commentLink,
comment_post_ID: postID,
comment_parent: replyID,
"wp-comment-cookies-consent": "yes",
@@ -2000,9 +2000,9 @@ if (argonConfig.waterflow_columns != "1") {
}
}
}
if (commentLink != "" && !(/https?:\/\//).test(commentLink)) {
if (commentLink != "" && commentLink.indexOf('.') == -1) {
isError = true;
errorMsg += __("网站格式错误 (不是 http(s):// 开头") + "</br>";
errorMsg += __("网站格式错误") + "</br>";
}
// 如果基本表单验证失败,显示错误信息并返回
@@ -3667,6 +3667,7 @@ if (argonConfig.disable_pjax != true && argonConfig.disable_pjax != 'true') {
try { foldLongComments(); } catch (err) { ArgonDebug.error('foldLongComments failed:', err); }
try { foldLongShuoshuo(); } catch (err) { ArgonDebug.error('foldLongShuoshuo failed:', err); }
try { handleHashNavigation(); } catch (err) { ArgonDebug.error('handleHashNavigation failed:', err); }
try { initArticleSkeletons(); } catch (err) { ArgonDebug.error('initArticleSkeletons failed:', err); }
$("html").trigger("resize");
@@ -5123,34 +5124,23 @@ setInterval(function(){
// 7.1 骨架屏加载动画 (Skeleton Screen)
function initArticleSkeletons() {
if (typeof jQuery === 'undefined') return;
var $articles = jQuery('.article-list article.post:not(.skeleton-processed)');
if ($articles.length === 0) return;
var $skeletons = jQuery('.article-skeleton:not(.skeleton-fading)');
if ($skeletons.length === 0) return;
$articles.each(function () {
var $this = jQuery(this);
$this.addClass('skeleton-processed skeleton-loading');
// 构造骨架屏 DOM
var skeletonHtml =
'<div class="argon-skeleton">' +
'<div class="argon-skeleton-item argon-skeleton-title"></div>' +
'<div class="argon-skeleton-item argon-skeleton-meta"></div>' +
'<div class="argon-skeleton-item argon-skeleton-line"></div>' +
'<div class="argon-skeleton-item argon-skeleton-line"></div>' +
'<div class="argon-skeleton-item argon-skeleton-line short"></div>' +
'</div>';
var $skeleton = jQuery(skeletonHtml);
$this.prepend($skeleton);
$skeletons.each(function () {
var $skeleton = jQuery(this);
$skeleton.addClass('skeleton-fading');
// 给予一定的展示时长,避免闪烁并确保背景稳定性
setTimeout(function () {
$this.removeClass('skeleton-loading');
$skeleton.addClass('article-skeleton-fade-out');
setTimeout(function () {
$skeleton.remove();
}, 400); // 配合 CSS 的 0.4s transition
}, 800); // 骨架屏显示 800ms
}, 400); // 配合 CSS transition
}, 400); // 骨架屏展示时长
});
}
window.initArticleSkeletons = initArticleSkeletons;
// 8. 减少动画偏好检查
function checkReducedMotion() {
@@ -5193,3 +5183,24 @@ setInterval(function(){
};
}
})();
/* 友情链接徽章点击动画 */
$(document).on("click", ".badge-friend", function (e) {
let x = e.clientX;
let y = e.clientY;
let $heart = $('<i class="fa fa-heart heart-bubble"></i>');
let drift = (Math.random() - 0.5) * 120;
let rotate = (Math.random() - 0.5) * 60;
let duration = 2.0 + Math.random() * 1.0;
$heart.css({
left: x + 'px',
top: y + 'px',
'--drift': drift + 'px',
'--rotate': rotate + 'deg',
'--duration': duration + 's'
});
$('body').append($heart);
setTimeout(() => {
$heart.remove();
}, duration * 1000);
});