您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Logger with repositioned Combat Logs button
当前为
// ==UserScript== // @name Torn Combat Logger Adjusted // @namespace http://torn.com/ // @version 2.8 // @description Logger with repositioned Combat Logs button // @author Quanna_Parker // @match https://www.torn.com/* // @grant none // ==/UserScript== (function() { 'use strict'; // Torn API key const apiKey = "ADD_API_KEY"; // Replace with your actual API key // Combat logs storage let combatLogs = JSON.parse(localStorage.getItem("combatLogs")) || []; // Create the button element function createButton(text, className, onClickFunction) { const button = document.createElement('button'); button.innerText = text; button.classList.add(className); button.addEventListener('click', onClickFunction); return button; } // Function to display logs in a window function viewLogs() { let logWindow = document.createElement('div'); logWindow.style.position = 'fixed'; logWindow.style.top = '50px'; logWindow.style.right = '50px'; logWindow.style.width = '400px'; logWindow.style.height = '400px'; logWindow.style.backgroundColor = 'white'; logWindow.style.border = '1px solid black'; logWindow.style.zIndex = 1000; logWindow.style.overflowY = 'scroll'; logWindow.style.padding = '10px'; logWindow.style.boxShadow = '0px 0px 10px rgba(0, 0, 0, 0.5)'; logWindow.style.borderRadius = '10px'; let closeButton = document.createElement('button'); closeButton.innerHTML = 'Close'; closeButton.style.float = 'right'; closeButton.onclick = function() { document.body.removeChild(logWindow); }; let logContent = document.createElement('div'); logWindow.appendChild(closeButton); logWindow.appendChild(logContent); document.body.appendChild(logWindow); // Logs display let logsHTML = '<h3>Combat Logs</h3>'; combatLogs.forEach(log => { logsHTML += `<p><strong>Time:</strong> ${log.time}<br/> <strong>Attacker:</strong> ${log.attacker}<br/> <strong>Damage:</strong> ${log.damage}<br/> <strong>Result:</strong> ${log.result}<br/> <strong>Attack Type:</strong> ${log.attackType}<br/> <strong>Your Health (Before):</strong> ${log.yourHealthBefore}<br/> <strong>Your Health (After):</strong> ${log.yourHealthAfter}</p><hr/>`; }); logContent.innerHTML = logsHTML; } // Create and place the Combat Logs button const combatLogBtn = createButton('Combat Logs', 'combat-logs-btn', viewLogs); // Find the yellow settings button and append Combat Logs button below it const settingsBtn = document.querySelector('.icon-bell2'); if (settingsBtn) { settingsBtn.parentNode.insertAdjacentElement('afterend', combatLogBtn); } // CSS for Combat Logs button: half size, better positioning const style = document.createElement('style'); style.innerHTML = ` .combat-logs-btn { padding: 5px; margin-top: 10px; background-color: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer; width: 50px; /* Reduced size */ font-size: 10px; position: relative; } `; document.head.appendChild(style); })();