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) { part1OffsetTop = $leftbarPart1.offset().top;
clearTimeout(leftbarMutationTimer); part1OuterHeight = $leftbarPart1.outerHeight();
} changeLeftbarStickyStatus();
leftbarMutationTimer = setTimeout(function() {
part1OffsetTop = $leftbarPart1.offset().top;
part1OuterHeight = $leftbarPart1.outerHeight();
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){
// 防抖处理,避免频繁重新计算 ele.onload = function(){
if (waterflowTimer) { waterflowInit();
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(){
loadedCount++;
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,62 +659,45 @@ 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);
if (columns == 1) {
// 使用 requestAnimationFrame 优化性能 $container.removeClass("waterflow");
requestAnimationFrame(function() { $items.css("transition", "").css("position", "").css("width", "").css("top", "").css("left", "").css("margin", "");
$("#primary").css("transition", "none").addClass("waterflow"); $(".waterflow-placeholder").remove();
}else{
if (columns == 1) { $container.addClass("waterflow");
$container.removeClass("waterflow"); $items.each(function(index, item) {
$items.css("transition", "").css("position", "").css("width", "").css("top", "").css("left", "").css("margin", ""); let $item = $(item);
$(".waterflow-placeholder").remove(); $item.css("transition", "none")
}else{ .css("position", "absolute")
$container.addClass("waterflow"); .css("width", "calc(" + (100 / columns) + "% - " + (10 * (columns - 1) / columns) + "px)").css("margin", 0);
$items.each(function(index, item) { let itemHeight = $item.outerHeight() + 10;
let $item = $(item); let pos = getMinHeightPosition();
$item.css("transition", "none") $item.css("top", heights[getMinHeightPosition()] + "px")
.css("position", "absolute") .css("left", (pos * $item.outerWidth() + 10 * pos) + "px");
.css("width", "calc(" + (100 / columns) + "% - " + (10 * (columns - 1) / columns) + "px)").css("margin", 0); heights[pos] += itemHeight;
let itemHeight = $item.outerHeight() + 10; });
let pos = getMinHeightPosition(); }
$item.css("top", heights[getMinHeightPosition()] + "px") if ($(".waterflow-placeholder").length) {
.css("left", (pos * $item.outerWidth() + 10 * pos) + "px"); $(".waterflow-placeholder").css("height", getMaxHeight() + "px");
heights[pos] += itemHeight; }else{
}); $container.prepend("<div class='waterflow-placeholder' style='height: " + getMaxHeight() +"px;'></div>");
} }
if ($(".waterflow-placeholder").length) {
$(".waterflow-placeholder").css("height", getMaxHeight() + "px");
}else{
$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) { waterflowInit();
clearTimeout(waterflowMutationTimer);
}
waterflowMutationTimer = setTimeout(function() {
// 重置图片加载状态,以便重新检查
waterflowImagesLoaded = false;
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) { changefabtnDisplayStatus();
window.requestAnimationFrame(function() {
changefabtnDisplayStatus();
fabtnScrollTicking = false;
});
fabtnScrollTicking = true;
}
}); });
$(window).resize(function(){ $(window).resize(function(){
changefabtnDisplayStatus(); changefabtnDisplayStatus();
@@ -2407,31 +2331,29 @@ 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'; setTimeout(function() {
requestAnimationFrame(function() { img.style.opacity = '1';
img.style.opacity = '1'; }, 10);
}); setTimeout(function() {
setTimeout(function() { img.style.transition = '';
img.style.transition = ''; }, 310);
}, 310); } else if (effect === 'slideDown') {
} else if (effect === 'slideDown') { 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'; setTimeout(function() {
requestAnimationFrame(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) { classInit();
clearTimeout(classInitTimer);
}
classInitTimer = setTimeout(function() {
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) { changeWidgetsDisplayStatus();
window.requestAnimationFrame(function() {
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 样式时才设置,避免布局突变 element.style.position = 'relative';
var computedStyle = window.getComputedStyle(element); element.style.overflow = 'hidden';
if (computedStyle.position === 'static') {
element.style.position = 'relative';
}
// 只在元素没有 overflow 样式时才设置,避免内容换行
if (computedStyle.overflow === 'visible') {
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