Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
273 changes: 156 additions & 117 deletions comments.php

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion css/animation.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,16 @@ body.dark .post-list-thumb {
background: rgb(26 26 26 / 70%);
}

/* 暗色模式骨架屏占位效果 */
body.dark .post-list-thumb:not(.post-list-show) {
background: linear-gradient(90deg,
rgba(26,26,26,0.5) 0%,
rgba(51,51,51,0.6) 50%,
rgba(26,26,26,0.5) 100%);
background-size: 200% 100%;
animation: skeleton-loading 1.5s ease-in-out infinite;
}

body.dark .post-list-thumb:hover {
box-shadow: 0 1px 20px 0px var(--article-theme-highlight,var(--theme-skin-dark));
background: rgb(26 26 26 / 90%);
Expand Down
108 changes: 105 additions & 3 deletions css/responsive.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
background: transparent;
border-bottom: 1.5px solid transparent;
will-change: transform;
/* 确保移动端导航栏的触摸事件正常工作 */
contain: none;
content-visibility: visible;
pointer-events: auto;
position: fixed;
z-index: 999;
}

.nav-search-wrapper,
Expand Down Expand Up @@ -83,6 +89,11 @@
display: none !important;
}


.headertop-down {
bottom: 15px;
}

.mo-nav-button,
.mo-toc-button {
font-size: 16px;
Expand All @@ -92,8 +103,20 @@
flex: 0 0 auto;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease, transform .5s cubic-bezier(0, 1.3, 0.55, 1.5);
-webkit-transition: all 0.3s ease, transform .5s cubic-bezier(0, 1.3, 0.55, 1.5);
/* 移动端触摸优化 */
touch-action: manipulation;
-webkit-tap-highlight-color: transparent;
cursor: pointer;
/* 确保可点击区域足够大 */
min-height: 44px;
min-width: 44px;
/* 防止 content-visibility 影响触摸事件 */
contain: none;
position: relative;
z-index: 100;
}

.mobile-nav.open,
Expand Down Expand Up @@ -506,6 +529,15 @@
}
}

/* 移动端增强封面遮罩,确保文字在亮色背景下可见 */
.pattern-center::before {
background: linear-gradient(
rgba(0, 0, 0, 0.2),
rgba(0, 0, 0, 0.5)
);
backdrop-filter: saturate(120%) blur(2px);
}

.pattern-attachment {
height: 280px;
}
Expand Down Expand Up @@ -658,15 +690,37 @@
position: relative;
}

/* 登录用户评论框移动端布局 */
.cmt-submit-container.logged-in-submit {
padding-left: 50px;
}

.comment-user-avatar.logged-in-avatar {
width: 40px;
height: 40px;
}

.comment-user-avatar.logged-in-avatar img {
width: 40px;
height: 40px;
}

.comment-checks.logged-in-checks {
flex-wrap: wrap;
gap: 10px;
justify-content: flex-end;
}

/* 未登录用户移动端布局 */
.comment-checks {
flex-direction: column;
align-items: flex-start;
flex-wrap: wrap;
margin-block-start: 15px;
gap: 15px;
gap: 10px;
}

.comment-captcha {
width: 100%;
margin-right: 0;
}

.comment-user-avatar {
Expand Down Expand Up @@ -937,4 +991,52 @@
transform: scale(0.6);
margin-block-end: -10px;
}

/* Mobile GPU acceleration optimization - same animation as PC with better performance */
.post-list-thumb {
-webkit-transform: translateZ(0);
transform: translateZ(0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}

/* Optimize lazyload images for mobile GPU */
.lazyload {
-webkit-transform: translateZ(0);
transform: translateZ(0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}

/* Optimize blur filter performance on mobile */
.lazyload[src*="#lazyload-blur"],
.lazyload[style*="#lazyload-blur"] {
-webkit-transform: translateZ(0);
transform: translateZ(0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
}

/* Smooth transition for viewport changes - prevents flickering during window resize */
@media all {
.post-list-thumb,
.post-list-show {
-webkit-transition: none;
transition: none;
}
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
.post-list-show {
animation: none !important;
opacity: 1 !important;
}

.lazyload[src*="#lazyload-blur"],
.lazyload[style*="#lazyload-blur"] {
-webkit-filter: none !important;
filter: none !important;
}
}
48 changes: 48 additions & 0 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,52 @@ function switch_blur_object (){
<div id="particles-js"></div>
<script type="application/json" id="particles-js-cfg"><?php echo iro_opt('particles_json', ''); ?></script>
<?php endif; ?>

<!-- 异步浏览量统计(支持静态缓存) -->
<style>.post-views-count.views-updated{animation:viewsFlash .5s ease}</style>
<script>
(function() {
'use strict';

function incrementAndUpdateViews() {
if (typeof _iro === 'undefined' || !_iro.ajax_url) return;

// 从 DOM 获取 post ID(支持 PJAX)
var viewsElement = document.querySelector('.post-views-count[data-post-id]');
if (!viewsElement) return;

var postId = viewsElement.getAttribute('data-post-id');
if (!postId || postId === '0') return;

var xhr = new XMLHttpRequest();
xhr.open('POST', _iro.ajax_url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
try {
var response = JSON.parse(xhr.responseText);
if (response.success && response.data) {
viewsElement.textContent = response.data.views + ' Views';
// 简单的高亮动画
viewsElement.classList.remove('views-updated');
void viewsElement.offsetWidth;
viewsElement.classList.add('views-updated');
}
} catch (e) {}
}
};
xhr.send('action=iro_increment_views&post_id=' + postId);
}

if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', incrementAndUpdateViews);
} else {
incrementAndUpdateViews();
}

document.addEventListener('pjax:complete', function() {
setTimeout(incrementAndUpdateViews, 100);
});
})();
</script>
Comment on lines +217 to +261
Copy link

Copilot AI Jan 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inline JavaScript for view counting should be wrapped in a DOMContentLoaded check or moved to an external file for better Content Security Policy (CSP) compliance. Additionally, the AJAX request doesn't include any nonce for CSRF protection, which should match the security token expected by the 'iro_ajax_increment_views' endpoint.

Copilot uses AI. Check for mistakes.
</html>
Loading