fix: 从 0dba91c 恢复 style.css 和 argontheme.js

- 完全恢复到问题出现前的版本
- 确保浮动按钮正常工作
This commit is contained in:
2026-01-20 16:26:20 +08:00
parent 98add1f41d
commit 29257dfce2
2 changed files with 1752 additions and 696 deletions

View File

@@ -587,18 +587,10 @@ $(document).on("change" , ".search-filter" , function(e){
part1OuterHeight = $leftbarPart1.outerHeight(); part1OuterHeight = $leftbarPart1.outerHeight();
changeLeftbarStickyStatus(); changeLeftbarStickyStatus();
}); });
// 防抖处理 MutationObserver
let leftbarMutationTimer = null;
new MutationObserver(function(){ new MutationObserver(function(){
if (leftbarMutationTimer) {
clearTimeout(leftbarMutationTimer);
}
leftbarMutationTimer = setTimeout(function() {
part1OffsetTop = $leftbarPart1.offset().top; part1OffsetTop = $leftbarPart1.offset().top;
part1OuterHeight = $leftbarPart1.outerHeight(); part1OuterHeight = $leftbarPart1.outerHeight();
changeLeftbarStickyStatus(); changeLeftbarStickyStatus();
}, 150);
}).observe(leftbarPart1, {attributes: true, childList: true, subtree: true}); }).observe(leftbarPart1, {attributes: true, childList: true, subtree: true});
}(); }();
@@ -624,56 +616,15 @@ if (argonConfig.headroom == "true"){
} }
/*瀑布流布局*/ /*瀑布流布局*/
let waterflowTimer = null;
let waterflowImagesLoaded = false;
function waterflowInit() { function waterflowInit() {
if (argonConfig.waterflow_columns == "1") { if (argonConfig.waterflow_columns == "1") {
return; return;
} }
$("#main.article-list img").each(function(index, ele){
// 防抖处理,避免频繁重新计算
if (waterflowTimer) {
clearTimeout(waterflowTimer);
}
waterflowTimer = setTimeout(function() {
waterflowRender();
}, 100);
}
function waterflowRender() {
// 检查图片是否已加载
if (!waterflowImagesLoaded) {
let images = $("#main.article-list img");
let loadedCount = 0;
let totalImages = images.length;
if (totalImages > 0) {
images.each(function(index, ele){
if (ele.complete) {
loadedCount++;
} else {
ele.onload = function(){ ele.onload = function(){
loadedCount++; waterflowInit();
if (loadedCount === totalImages) {
waterflowImagesLoaded = true;
waterflowRender();
}
};
} }
}); });
// 如果所有图片已加载
if (loadedCount === totalImages) {
waterflowImagesLoaded = true;
} else {
// 等待图片加载
return;
}
}
}
let columns; let columns;
if (argonConfig.waterflow_columns == "2and3") { if (argonConfig.waterflow_columns == "2and3") {
if ($("#main").outerWidth() > 1000) { if ($("#main").outerWidth() > 1000) {
@@ -708,19 +659,14 @@ function waterflowRender() {
} }
return res; return res;
} }
$("#primary").css("transition", "none")
.addClass("waterflow");
let $container = $("#main.article-list"); let $container = $("#main.article-list");
if (!$container.length){ if (!$container.length){
return; return;
} }
let $items = $container.find("article.post:not(.no-results), .shuoshuo-preview-container"); let $items = $container.find("article.post:not(.no-results), .shuoshuo-preview-container");
columns = Math.max(Math.min(columns, $items.length), 1); columns = Math.max(Math.min(columns, $items.length), 1);
// 使用 requestAnimationFrame 优化性能
requestAnimationFrame(function() {
$("#primary").css("transition", "none").addClass("waterflow");
if (columns == 1) { if (columns == 1) {
$container.removeClass("waterflow"); $container.removeClass("waterflow");
$items.css("transition", "").css("position", "").css("width", "").css("top", "").css("left", "").css("margin", ""); $items.css("transition", "").css("position", "").css("width", "").css("top", "").css("left", "").css("margin", "");
@@ -739,31 +685,19 @@ function waterflowRender() {
heights[pos] += itemHeight; heights[pos] += itemHeight;
}); });
} }
if ($(".waterflow-placeholder").length) { if ($(".waterflow-placeholder").length) {
$(".waterflow-placeholder").css("height", getMaxHeight() + "px"); $(".waterflow-placeholder").css("height", getMaxHeight() + "px");
}else{ }else{
$container.prepend("<div class='waterflow-placeholder' style='height: " + getMaxHeight() +"px;'></div>"); $container.prepend("<div class='waterflow-placeholder' style='height: " + getMaxHeight() +"px;'></div>");
} }
});
} }
waterflowInit(); waterflowInit();
if (argonConfig.waterflow_columns != "1") { if (argonConfig.waterflow_columns != "1") {
$(window).resize(function(){ $(window).resize(function(){
waterflowInit(); waterflowInit();
}); });
// 防抖处理 MutationObserver
let waterflowMutationTimer = null;
new MutationObserver(function(mutations, observer){ new MutationObserver(function(mutations, observer){
if (waterflowMutationTimer) {
clearTimeout(waterflowMutationTimer);
}
waterflowMutationTimer = setTimeout(function() {
// 重置图片加载状态,以便重新检查
waterflowImagesLoaded = false;
waterflowInit(); waterflowInit();
}, 150);
}).observe(document.querySelector("#primary"), { }).observe(document.querySelector("#primary"), {
'childList': true 'childList': true
}); });
@@ -990,18 +924,8 @@ if (argonConfig.waterflow_columns != "1") {
} }
} }
changefabtnDisplayStatus(); changefabtnDisplayStatus();
// 节流处理滚动事件
let fabtnScrollTimer = null;
let fabtnScrollTicking = false;
$(window).scroll(function(){ $(window).scroll(function(){
if (!fabtnScrollTicking) {
window.requestAnimationFrame(function() {
changefabtnDisplayStatus(); changefabtnDisplayStatus();
fabtnScrollTicking = false;
});
fabtnScrollTicking = true;
}
}); });
$(window).resize(function(){ $(window).resize(function(){
changefabtnDisplayStatus(); changefabtnDisplayStatus();
@@ -2407,14 +2331,13 @@ function loadImage(img, effect) {
// 移除所有 lazyload-style-* 类 // 移除所有 lazyload-style-* 类
img.className = img.className.replace(/\blazyload-style-\d+\b/g, '').trim(); img.className = img.className.replace(/\blazyload-style-\d+\b/g, '').trim();
// 应用加载效果(使用 requestAnimationFrame 优化性能) // 应用加载效果
requestAnimationFrame(function() {
if (effect === 'fadeIn') { if (effect === 'fadeIn') {
img.style.opacity = '0'; img.style.opacity = '0';
img.style.transition = 'opacity 0.3s ease'; img.style.transition = 'opacity 0.3s ease';
requestAnimationFrame(function() { setTimeout(function() {
img.style.opacity = '1'; img.style.opacity = '1';
}); }, 10);
setTimeout(function() { setTimeout(function() {
img.style.transition = ''; img.style.transition = '';
}, 310); }, 310);
@@ -2422,16 +2345,15 @@ function loadImage(img, effect) {
img.style.opacity = '0'; img.style.opacity = '0';
img.style.transform = 'translateY(-20px)'; img.style.transform = 'translateY(-20px)';
img.style.transition = 'opacity 0.3s ease, transform 0.3s ease'; img.style.transition = 'opacity 0.3s ease, transform 0.3s ease';
requestAnimationFrame(function() { setTimeout(function() {
img.style.opacity = '1'; img.style.opacity = '1';
img.style.transform = 'translateY(0)'; img.style.transform = 'translateY(0)';
}); }, 10);
setTimeout(function() { setTimeout(function() {
img.style.transition = ''; img.style.transition = '';
img.style.transform = ''; img.style.transform = '';
}, 310); }, 310);
} }
});
}; };
tempImg.onerror = function() { tempImg.onerror = function() {
// 加载失败时使用原始 src // 加载失败时使用原始 src
@@ -2495,16 +2417,8 @@ if ($("html").hasClass("banner-as-cover")){
} }
} }
classInit(); classInit();
// 防抖处理 MutationObserver
let classInitTimer = null;
new MutationObserver(function(mutations, observer){ new MutationObserver(function(mutations, observer){
if (classInitTimer) {
clearTimeout(classInitTimer);
}
classInitTimer = setTimeout(function() {
classInit(); classInit();
}, 150);
}).observe(document.querySelector("#primary"), { }).observe(document.querySelector("#primary"), {
'childList': true 'childList': true
}); });
@@ -2528,17 +2442,8 @@ if ($("html").hasClass("banner-as-cover")){
} }
} }
changeWidgetsDisplayStatus(); changeWidgetsDisplayStatus();
// 节流处理滚动事件
let widgetsScrollTicking = false;
$(window).scroll(function(){ $(window).scroll(function(){
if (!widgetsScrollTicking) {
window.requestAnimationFrame(function() {
changeWidgetsDisplayStatus(); changeWidgetsDisplayStatus();
widgetsScrollTicking = false;
});
widgetsScrollTicking = true;
}
}); });
$(window).resize(function(){ $(window).resize(function(){
changeWidgetsDisplayStatus(); changeWidgetsDisplayStatus();
@@ -3886,15 +3791,8 @@ void 0;
ripple.className = 'touch-ripple'; ripple.className = 'touch-ripple';
var oldRipple = element.querySelector('.touch-ripple'); var oldRipple = element.querySelector('.touch-ripple');
if (oldRipple) oldRipple.remove(); if (oldRipple) oldRipple.remove();
// 只在元素没有 position 样式时才设置,避免布局突变
var computedStyle = window.getComputedStyle(element);
if (computedStyle.position === 'static') {
element.style.position = 'relative'; element.style.position = 'relative';
}
// 只在元素没有 overflow 样式时才设置,避免内容换行
if (computedStyle.overflow === 'visible') {
element.style.overflow = 'hidden'; element.style.overflow = 'hidden';
}
element.appendChild(ripple); element.appendChild(ripple);
setTimeout(function() { ripple.remove(); }, 600); setTimeout(function() { ripple.remove(); }, 600);
} }

2224
style.css

File diff suppressed because it is too large Load Diff