您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows only revives above a certain % and colors the row
// ==UserScript== // @name Show Only Revives Above X% (Full Row Color) // @namespace http://tampermonkey.net/ // @version 1.8 // @description Shows only revives above a certain % and colors the row // @match https://www.torn.com/hospital* // @grant none // ==/UserScript== (function () { "use strict"; let minChance = parseFloat(localStorage.getItem("RRBX_chance")) || 20; const addButton = () => { if (document.querySelector(".rrbx")) return; const btn = document.createElement("button"); btn.innerHTML = "% Setting"; btn.className = "rrbx t-clear h c-pointer m-icon line-h24 right last"; btn.onclick = () => { let input = parseFloat(prompt("Show only revive chances ABOVE what %?", minChance)); if (!isNaN(input) && input >= 0 && input <= 100) { minChance = input; localStorage.setItem("RRBX_chance", minChance); } }; document.querySelector("#top-page-links-list")?.appendChild(btn); }; const getColorForChance = (percent) => { if (percent > 90) return "#4CAF50"; // Green else if (percent > 60) return "#FFD700"; // Gold else if (percent > 40) return "#FFA500"; // Orange else return "#DC143C"; // Red }; const filterAndColorRevives = () => { document.querySelectorAll(".revive > li").forEach(row => { if (row.querySelector("a.reviveNotAvailable")) { row.remove(); return; } const percentText = row.querySelector(".ajax-action b")?.textContent; if (!percentText) return; const percent = parseFloat(percentText.replace("%", "")); if (isNaN(percent)) return; // Remove if below or equal to the minChance if (percent <= minChance) { row.remove(); return; } // Color the whole row const color = getColorForChance(percent); row.style.backgroundColor = color; row.style.color = (percent > 60 ? "black" : "white"); row.style.fontWeight = "bold"; }); }; setInterval(() => { addButton(); filterAndColorRevives(); }, 300); })();