From e97ed939add4ac32ea39ce444297dc077e879bc0 Mon Sep 17 00:00:00 2001 From: HaibinLai <12211612@mail.sustech.edu.cn> Date: Sun, 27 Jul 2025 07:40:45 +0000 Subject: [PATCH 001/100] add jquery + swiper --- functions.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/functions.php b/functions.php index a65a4bd..82fb17a 100644 --- a/functions.php +++ b/functions.php @@ -1,5 +1,17 @@ Date: Fri, 12 Dec 2025 18:00:56 +0800 Subject: [PATCH 002/100] add style for quote block --- style.css | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/style.css b/style.css index 1b707a5..e744356 100644 --- a/style.css +++ b/style.css @@ -2313,3 +2313,18 @@ html { display: none; } html body .main-container .main-main .div-info .comment-form .comment-form-main .comment-textarea .emoji-list { width: 80%; } } + + +html body .main-container .main-main .main-content .main-article blockquote{ + margin: 1rem 0; + padding: .75rem 1rem; + border-left: 4px solid var(--theme-color); + background: rgba(0,0,0,.04); + border-radius: 6px; +} + +html body .main-container .main-main .main-content .main-article blockquote p{ + margin: .4rem 0; +} + + From f49e8c02c500547ee1c17be357a15677c43159dc Mon Sep 17 00:00:00 2001 From: HaibinLai <12211612@mail.sustech.edu.cn> Date: Wed, 14 Jan 2026 20:32:57 +0800 Subject: [PATCH 003/100] =?UTF-8?q?try=20to=20fix=20=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E5=AF=BC=E8=87=B4=E5=AF=BC=E8=88=AA=E6=A0=8F?= =?UTF-8?q?=E9=94=99=E4=BD=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/main.js | 133 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/common/main.js b/common/main.js index 6127edd..cc5b651 100644 --- a/common/main.js +++ b/common/main.js @@ -475,6 +475,139 @@ $(function ($) { } } }); + + /* + * 图片加载完成后重新计算导航栏位置 + * 解决图片懒加载导致的高度计算不准确问题 + * */ + (function() { + let imageLoadTimer = null; //防抖计时器 + let loadedImages = 0; //已加载图片计数 + let totalImages = 0; //总图片数 + + // 重新计算导航栏位置的函数(带防抖) + function recalculateOnImageLoad() { + if (imageLoadTimer) { + clearTimeout(imageLoadTimer); + } + imageLoadTimer = setTimeout(function() { + if (typeof computed === 'function') { + computed(); //重新计算高度 + } + if (typeof toFixed === 'function') { + toFixed(); //重新计算位置 + } + }, 100); //防抖延迟100ms + } + + // 监听所有图片的加载事件 + function setupImageLoadListeners() { + const images = document.querySelectorAll('img'); + totalImages = images.length; + + if (totalImages === 0) { + // 如果没有图片,直接执行一次计算 + recalculateOnImageLoad(); + return; + } + + images.forEach(function(img) { + // 如果图片已经加载完成 + if (img.complete && img.naturalHeight !== 0) { + loadedImages++; + if (loadedImages === totalImages) { + recalculateOnImageLoad(); + } + } else { + // 监听图片加载完成事件 + img.addEventListener('load', function() { + loadedImages++; + if (loadedImages === totalImages) { + recalculateOnImageLoad(); + } else { + // 每张图片加载完成都重新计算一次(防抖会合并多次调用) + recalculateOnImageLoad(); + } + }, { once: true }); + + // 监听图片加载错误事件(也要重新计算) + img.addEventListener('error', function() { + loadedImages++; + recalculateOnImageLoad(); + }, { once: true }); + } + }); + } + + // 页面加载完成后也重新计算一次 + if (document.readyState === 'complete') { + setupImageLoadListeners(); + } else { + window.addEventListener('load', function() { + setupImageLoadListeners(); + }); + } + + // 监听动态添加的图片(使用 MutationObserver) + if (typeof MutationObserver !== 'undefined') { + const observer = new MutationObserver(function(mutations) { + let hasNewImages = false; + mutations.forEach(function(mutation) { + mutation.addedNodes.forEach(function(node) { + if (node.nodeType === 1) { // Element node + if (node.tagName === 'IMG') { + hasNewImages = true; + totalImages++; + if (node.complete && node.naturalHeight !== 0) { + loadedImages++; + recalculateOnImageLoad(); + } else { + node.addEventListener('load', function() { + loadedImages++; + recalculateOnImageLoad(); + }, { once: true }); + node.addEventListener('error', function() { + loadedImages++; + recalculateOnImageLoad(); + }, { once: true }); + } + } else if (node.querySelectorAll) { + const imgs = node.querySelectorAll('img'); + if (imgs.length > 0) { + hasNewImages = true; + totalImages += imgs.length; + imgs.forEach(function(img) { + if (img.complete && img.naturalHeight !== 0) { + loadedImages++; + recalculateOnImageLoad(); + } else { + img.addEventListener('load', function() { + loadedImages++; + recalculateOnImageLoad(); + }, { once: true }); + img.addEventListener('error', function() { + loadedImages++; + recalculateOnImageLoad(); + }, { once: true }); + } + }); + } + } + } + }); + }); + if (hasNewImages) { + recalculateOnImageLoad(); + } + }); + + // 开始观察DOM变化 + observer.observe(document.body, { + childList: true, + subtree: true + }); + } + })(); } })(); From 403d86dc82b021d5224356e88a99ed1edce2cb6e Mon Sep 17 00:00:00 2001 From: HaibinLai <12211612@mail.sustech.edu.cn> Date: Wed, 14 Jan 2026 20:39:50 +0800 Subject: [PATCH 004/100] =?UTF-8?q?try=20to=20fix=20=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=8F=E9=94=99=E4=BD=8D=E9=87=8D=E6=96=B0=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/main.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/main.js b/common/main.js index cc5b651..21f6fd4 100644 --- a/common/main.js +++ b/common/main.js @@ -267,7 +267,8 @@ $(function ($) { * */ function fixedLeft() { - let html_scrollTop = html.scrollTop(); + // 优先使用 window.scrollY,兼容某些浏览器 html.scrollTop 始终为 0 的情况 + let html_scrollTop = window.scrollY || html.scrollTop(); if (html_scrollTop >= _absolute) { @@ -388,8 +389,8 @@ $(function ($) { isFixed = true;//标记正在滚动 - // 已经滚动的距离 - let html_scrollTop = html.scrollTop(); + // 已经滚动的距离(优先使用 window.scrollY,兼容性更好) + let html_scrollTop = window.scrollY || html.scrollTop(); /* * 大于保持静态,小于保持绝对 From a8605ecefce7cc2caf5c2e3ab9349025416beb6e Mon Sep 17 00:00:00 2001 From: HaibinLai <12211612@mail.sustech.edu.cn> Date: Wed, 14 Jan 2026 20:42:31 +0800 Subject: [PATCH 005/100] =?UTF-8?q?try=20to=20fix=20=E6=AF=8F=E6=AC=A1?= =?UTF-8?q?=E6=BB=91=E5=8A=A8=E9=87=8D=E6=96=B0=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/main.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/common/main.js b/common/main.js index 21f6fd4..e4c4e48 100644 --- a/common/main.js +++ b/common/main.js @@ -266,6 +266,12 @@ $(function ($) { * 左侧边栏位置检测 * */ function fixedLeft() { + // 每次调用时都重新获取最新的位置和高度值,确保计算准确 + if (space.length > 0) { + topTop = $('#space').getTop(); + topHeight = navigator.outerHeight(); + topOffset = innerHeight - topHeight - topTop; + } // 优先使用 window.scrollY,兼容某些浏览器 html.scrollTop 始终为 0 的情况 let html_scrollTop = window.scrollY || html.scrollTop(); @@ -274,7 +280,9 @@ $(function ($) { if (html_scrollTop >= _absolute) { isfixedLeft = true; + // 重新获取最新高度(可能因为图片加载而变化) topHeight = navigator.outerHeight(); + topTop = $('#space').getTop(); topOffset = innerHeight - topHeight - topTop; @@ -315,8 +323,21 @@ $(function ($) { top = min; } + // 确保 top 值不会超出可视区域(防止侧栏移出屏幕) + // top 值应该在 min 和 (min + navigator.height()) 之间 + if (top < min) { + top = min; + } + // 确保侧栏底部不会超出屏幕底部 + let maxTop = innerHeight - navigator.outerHeight() - 20; // 留20px边距 + if (top > maxTop && maxTop > min) { + top = maxTop; + } navigator.css('top', top); + } else { + // 如果还没到需要偏移的位置,确保侧栏在初始位置 + navigator.css('top', topTop); } } else { @@ -367,6 +388,8 @@ $(function ($) { * 滚动、屏幕大小变化时,动态更新右侧侧边栏的位置 * */ function toFixed() { + // 每次滚动时都重新计算高度值,因为页面高度可能在滚动过程中发生变化(如图片加载) + computed(); /* * 如果有左侧边栏 From 479f15ae96e18b0522886c677730b7fffd5bac63 Mon Sep 17 00:00:00 2001 From: HaibinLai <12211612@mail.sustech.edu.cn> Date: Wed, 14 Jan 2026 20:54:30 +0800 Subject: [PATCH 006/100] =?UTF-8?q?=E8=8B=B1=E6=96=87=E5=8C=96=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/index/breadcrumb.php | 2 +- template/index/search.php | 2 +- template/index/sidebar-index-left.php | 2 +- template/index/sidebar-left.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/template/index/breadcrumb.php b/template/index/breadcrumb.php index ad51002..49d4e34 100644 --- a/template/index/breadcrumb.php +++ b/template/index/breadcrumb.php @@ -36,7 +36,7 @@ ?> diff --git a/template/index/sidebar-index-left.php b/template/index/sidebar-index-left.php index d1e998b..433a995 100644 --- a/template/index/sidebar-index-left.php +++ b/template/index/sidebar-index-left.php @@ -20,7 +20,7 @@