您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
The fastest way to request a revive from Nomad Medical: with a button on your main page, you're just a click away from being in the hands of our great revivers. Never hesitate to use the Nomad Medical revive service!
当前为
// ==UserScript== // @name Nomad's Quick Revive // @namespace http://tampermonkey.net/ // @version 1.0.5 // @description The fastest way to request a revive from Nomad Medical: with a button on your main page, you're just a click away from being in the hands of our great revivers. Never hesitate to use the Nomad Medical revive service! // @author LilyWaterbug // @match https://www.torn.com/* // @grant GM_xmlhttpRequest // @license MIT // ==/UserScript== (function () { 'use strict'; const observer = new MutationObserver(() => { const targetContainer = document.querySelector('.toggle-content___BJ9Q9 .content___GVtZ_'); if (targetContainer) { if (document.getElementById('quick-revive-button')) return; const button = document.createElement('button'); button.id = 'quick-revive-button'; button.innerText = 'Nurse Nomad'; // Estilos del botón button.style.margin = '10px auto'; button.style.padding = '2.5px 15px'; button.style.display = 'block'; button.style.fontSize = '14px'; button.style.backgroundColor = '#D32F2F'; // Color principal button.style.color = '#FFFFFF'; // Texto blanco button.style.border = 'none'; // Sin bordes directos button.style.borderRadius = '5px'; button.style.cursor = 'pointer'; button.style.fontWeight = 'bold'; button.style.webkitTextStroke = '0.2px #FFFFFF'; button.style.textAlign = 'center'; // Outline doble button.style.boxShadow = ` 0 0 0 2px #f2f2f2, 0 0 0 4px #D32F2F `; button.addEventListener('click', () => { // Obtener el nombre del usuario const nameElement = document.querySelector('.menu-info-row___YG31c .menu-value___gLaLR'); const userLink = nameElement?.getAttribute('href'); const userName = nameElement?.textContent; // Extraer el ID del href const userIdMatch = userLink?.match(/XID=(\d+)/); const userId = userIdMatch ? userIdMatch[1] : null; if (!userName || !userId) { alert('Error: Unable to extract user information.'); return; } // Formatear el nombre del usuario const formattedUser = `${userName} [${userId}]`; // Llamada a la API de Torn const apiUrl = `https://api.torn.com/user/${userId}?selections=&key=yVgFxDZ3FxdruqSr`; GM_xmlhttpRequest({ method: "GET", url: apiUrl, onload: function (response) { if (response.status === 200) { const apiData = JSON.parse(response.responseText); // Extraer datos de API const status = apiData.status?.description || "N/A"; const statusState = apiData.status?.state || "N/A"; const revivable = apiData.revivable || 0; const faction = apiData.faction?.faction_name || "No Faction"; const factionId = apiData.faction?.faction_id || null; const factionUrl = factionId ? `https://www.torn.com/factions.php?step=profile&ID=${factionId}#/` : "No Faction URL"; const details = apiData.status?.details || "No Details"; // Verificar si el estado no es "Hospital" if (statusState !== "Hospital") { alert("You're not hospitalized right now."); return; } // Verificar si el usuario no tiene revives encendidos if (revivable === 0) { alert("Turn on your revives!"); return; } // Preparar datos para el webhook const data = { function: "revive", usuario: formattedUser, status: status, faction: faction, faction_url: factionUrl, details: details, }; // Enviar datos al webhook GM_xmlhttpRequest({ method: "POST", url: "http://lilywaterbug.art/webhook", headers: { "Content-Type": "application/json", }, data: JSON.stringify(data), onload: function (webhookResponse) { if (webhookResponse.status === 200) { alert('Revive request sent successfully!'); alert('Disclaimer: Please pay 1M or a Xanax to the person reviving you.'); } else { alert('Failed to send revive request. Status: ' + webhookResponse.status); } }, onerror: function () { alert('An error occurred while sending the revive request.'); } }); } else { alert('Failed to fetch Torn API data. Status: ' + response.status); } }, onerror: function () { alert('An error occurred while fetching Torn API data.'); } }); }); targetContainer.appendChild(button); } }); observer.observe(document.body, { childList: true, subtree: true }); })();