Hides the number 0 for the Reply, Repost and Like buttons.
当前为
// ==UserScript==
// @name Bluesky - Remove Zeroes from Buttons
// @author @thissteveguy.bsky.app
// @version 23.10.20
// @description Hides the number 0 for the Reply, Repost and Like buttons.
// @namespace https://greasyfork.org/en/users/253-lednerg
// @license (CC) Attribution Non-Commercial Share Alike; http://creativecommons.org/licenses/by-nc-sa/3.0/
// @match *://bsky.app/*
// @grant GM_addStyle
// ==/UserScript==
// For Replies and Likes, we're able to just use simple CSS to detect and hide zeroes.
GM_addStyle(`
button[aria-label="Reply (0 replies)"] div,
button[aria-label="Like (0 likes)"] div {
opacity: 0 !important;
}
`);
// For Reposts, we have to use a little JavaScript.
function hideZeroReposts() {
const repostCounts = document.querySelectorAll('[data-testid="repostCount"]');
repostCounts.forEach((element) => {
if (element.textContent.trim() === "0") {
element.style.opacity = "0";
}
});
}
// Run the function initially
hideZeroReposts();
// Run the function when the DOM changes
const observer = new MutationObserver(hideZeroReposts);
observer.observe(document.body, { childList: true, subtree: true });