您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Tracks Keno number frequency during a session and displays the top 10 hottest numbers. Waits for dynamic content.
当前为
// ==UserScript== // @name Torn Keno Hot Numbers // @namespace torn.keno.hotnumbers.tracker // @version 3.2 // @description Tracks Keno number frequency during a session and displays the top 10 hottest numbers. Waits for dynamic content. // @author eaksquad // @match https://www.torn.com/page.php?sid=keno // @icon https://www.google.com/s2/favicons?sz=64&domain=torn.com // @grant none // @run-at document-start // @license MIT // ==/UserScript== (function() { 'use strict'; function main() { const KENO_DATA_URL_FRAGMENT = 'page.php?rfcv='; let numberFrequency = {}; let isInitialized = false; function addCustomStyles() { const style = document.createElement('style'); style.innerHTML = ` /* Main container for our UI */ #keno-hot-numbers-container { /* Paired with the parent's flex-wrap, this ensures our panel takes a full row. */ flex-basis: 100%; background-color: #f2f2f2; border-radius: 5px; margin-bottom: 15px; border: 1px solid #ccc; box-shadow: 0 2px 3px rgba(0,0,0,0.1); } .dark-mode #keno-hot-numbers-container { background-color: #3d3d3d; border-color: #444; } /* Header for the panel */ .keno-hot-numbers-header { padding: 10px; background-color: #e8e8e8; border-top-left-radius: 5px; border-top-right-radius: 5px; font-weight: bold; font-size: 14px; color: #333; border-bottom: 1px solid #ddd; text-align: center; } .dark-mode .keno-hot-numbers-header { background-color: #2e2e2e; border-color: #444; color: #ccc; } /* Body where the numbers are displayed */ #keno-hot-numbers-body { padding: 15px; display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: center; min-height: 40px; align-items: center; color: #666; } .dark-mode #keno-hot-numbers-body { color: #999; } /* The individual number "pills" */ .hot-number-pill { background-color: #fff; border: 1px solid #ccc; border-radius: 20px; padding: 5px 12px; font-size: 14px; display: flex; align-items: center; gap: 6px; box-shadow: 0 1px 1px rgba(0,0,0,0.05); transition: transform 0.2s ease; } .dark-mode .hot-number-pill { background-color: #2a2a2a; border-color: #555; box-shadow: none; } .hot-number-pill:hover { transform: translateY(-2px); } .hot-number-pill strong { color: #000; font-size: 15px; } .dark-mode .hot-number-pill strong { color: #eee; } .hot-number-pill span { font-size: 11px; font-weight: bold; color: #555; } .dark-mode .hot-number-pill span { color: #888; } `; document.head.appendChild(style); } // *** THIS IS THE KEY MODIFICATION *** function createHotNumbersUI() { const kenoGame = document.getElementById('kenoGame'); if (kenoGame && !document.getElementById('keno-hot-numbers-container')) { // *** THE FIX *** // Programmatically apply 'flex-wrap: wrap' to the parent container. // This allows our 100% width panel to force the other items onto a new row. kenoGame.style.flexWrap = 'wrap'; const container = document.createElement('div'); container.id = 'keno-hot-numbers-container'; container.innerHTML = `<div class="keno-hot-numbers-header">Hot Numbers (Session)</div><div id="keno-hot-numbers-body">Play a round to start tracking numbers...</div>`; kenoGame.prepend(container); } } function updateHotNumbersDisplay(drawnNumbers) { drawnNumbers.forEach(num => { numberFrequency[num] = (numberFrequency[num] || 0) + 1; }); const sortedNumbers = Object.entries(numberFrequency).sort(([, a], [, b]) => b - a).slice(0, 10); const displayBody = document.getElementById('keno-hot-numbers-body'); if (displayBody) { displayBody.innerHTML = sortedNumbers.map(([number, count]) => `<div class="hot-number-pill"><strong>${number}</strong><span>(x${count})</span></div>`).join(''); } } function interceptXHR() { const open = XMLHttpRequest.prototype.open; XMLHttpRequest.prototype.open = function(method, url) { this._url = url; return open.apply(this, arguments); }; const send = XMLHttpRequest.prototype.send; XMLHttpRequest.prototype.send = function() { this.addEventListener('load', function() { if (this._url && this._url.includes(KENO_DATA_URL_FRAGMENT)) { try { const data = JSON.parse(this.responseText); if (data && data.randomNumbers) updateHotNumbersDisplay(data.randomNumbers); } catch (e) { console.error("[Keno Tracker] Error parsing game JSON.", e); } } }); return send.apply(this, arguments); }; } function initializeScript() { if (isInitialized) return; isInitialized = true; addCustomStyles(); createHotNumbersUI(); interceptXHR(); console.log("[Keno Tracker] Script is active and UI layout is configured."); } const observer = new MutationObserver(() => { if (document.getElementById('boardContainer')) { initializeScript(); observer.disconnect(); } }); observer.observe(document.body, { childList: true, subtree: true }); if (document.getElementById('boardContainer')) { initializeScript(); observer.disconnect(); } } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', main, { once: true }); } else { main(); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址