对于评论区中回复的楼层:
应仅显示在二级楼层并屏蔽一级楼层;
这将有效缩短楼层进度条长度,改善阅读体验 。
啊嘞,你别点那个三个回复不就好了,那是别人回复他的啊,不然那么多回复,谁知道是谁回复谁
6 个赞
可能是B站刷习惯了,对于同一楼层的回复喜欢展开看,若保留这种冗余现象,可能导致回复间相隔很多个楼层,破坏了同一主题的连贯性,导致较差的阅读体验
6 个赞
这不是问题,就是这么设计的
4 个赞
是的 , 我觉得这种设计确实有点冗余了 ,对于层回复来说不应该再独占外面的层
6 个赞
原来还有人跟我的阅读习惯一样,送你个油猴脚本。
// ==UserScript==
// @name linux.do隐藏回复帖子
// @namespace
// @version 2024-03-11
// @description 不查看回复贴
// @author Jason
// @match https://linux.do/*
// @icon
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// 简化对localStorage的访问
const storage = {
set: (key, value) => window.localStorage.setItem(key, value),
get: (key, defaultValue) => window.localStorage.getItem(key) || defaultValue,
};
// 根据设置隐藏或显示回复帖子
function toggleRepliesVisibility() {
const isHidden = storage.get("hide_replies", "off") === "on";
const posts = document.querySelectorAll(".topic-post");
posts.forEach(post => {
const hasReply = post.querySelector(".reply-to-tab") !== null;
post.style.display = isHidden && hasReply ? 'none' : '';
});
}
// 创建并配置按钮
function createToggleButton() {
if (document.getElementById("toggleRepliesVisibilityBtn")) {
// 如果按钮已存在,则无需重复创建
return;
}
const btn = document.createElement("button");
btn.id = "toggleRepliesVisibilityBtn";
btn.textContent = storage.get("hide_replies", "off") === "on" ? '查看回复' : '不看回复';
btn.onclick = function() {
const currentState = storage.get("hide_replies", "off");
const newState = currentState === "on" ? "off" : "on";
btn.textContent = newState === "on" ? '查看回复' : '不看回复';
storage.set("hide_replies", newState);
toggleRepliesVisibility(); //立即应用显示设置
};
// 设置按钮样式
// btn.style.backgroundColor = "#555";
// btn.style.color = "#FFF";
// btn.style.border = "none";
// btn.style.padding = "10px 20px";
// btn.style.margin = "10px";
// btn.style.borderRadius = "5px";
// btn.style.cursor = "pointer";
btn.className = "btn btn-icon-text btn-default";
// 添加按钮到页面特定位置
const controlsContainer = document.querySelector(".timeline-footer-controls");
if (controlsContainer) {
controlsContainer.appendChild(btn);
}
}
// 监听页面变化来重新应用显示设置
function observePageChanges() {
const observer = new MutationObserver((mutations) => {
// Check if the specific location for the button exists and if the button does not
if (document.querySelector(".timeline-footer-controls") && !document.getElementById("toggleRepliesVisibilityBtn")) {
createToggleButton();
}
toggleRepliesVisibility(); // 重新应用显示设置
});
observer.observe(document.body, { childList: true, subtree: true });
}
// 初始化脚本
function init() {
if (document.readyState === 'complete') {
createToggleButton();
observePageChanges();
toggleRepliesVisibility(); // 初始应用显示设置
} else {
window.addEventListener('load', () => {
createToggleButton();
observePageChanges();
toggleRepliesVisibility();
});
}
}
init();
})();
8 个赞
谢大佬赏赐脚本,爱你哟
3 个赞
谢谢大佬 我试试
3 个赞
感谢大佬的脚本
3 个赞
为啥我 还在外面
3 个赞
我也是用了,但是还在外面
3 个赞
喜欢逼呼的评论阅读方式
3 个赞
好用了
2 个赞
好用了~
2 个赞
紧挨着的回复是没有标识的
2 个赞
原来是这样,那我改改我的代码,hhh
2 个赞
感谢大佬,这个会上线greasyfork吗
1 个赞
大佬666,请问一下,回复的回复的回复会怎么样?
1 个赞
你来试试~