您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Highlight divs with questions count>0 or answers count > 0 on Stack Exchange profiles
当前为
// ==UserScript== // @name Highlight accounts whose questions or answers count > 0 on Stack Exchange profiles // @namespace http://tampermonkey.net/ // @version 0.1 // @description Highlight divs with questions count>0 or answers count > 0 on Stack Exchange profiles // @author aspen138 // @match https://stackexchange.com/users/*/*?tab=accounts // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Define the highlight style const highlightStyle = 'background-color: yellow;'; // Change this to your preferred highlight style // Function to check and highlight the div for questions or answers function highlightIfActive() { // Select all the account containers const accountContainers = document.querySelectorAll('.account-container'); accountContainers.forEach(container => { // Select the questions and answers counts based on their position const questions = container.querySelector('.account-stat:nth-last-child(3) .account-number'); const answers = container.querySelector('.account-stat:nth-last-child(2) .account-number'); // Check if the questions or answers count is greater than 0 and apply the highlight if ((questions && parseInt(questions.textContent, 10) > 0) || (answers && parseInt(answers.textContent, 10) > 0)) { container.style.cssText = highlightStyle; } else{ // container.style.cssText = highlightStyle; } }); } // Run the highlight function highlightIfActive(); })();