您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Enables a disabled button on Torn profile page and redirects to the attack page when the button is clicked
当前为
- // ==UserScript==
- // @name Enable Attack Button on Torn Profile Page
- // @namespace https://lordrhino.co.uk/
- // @version 1.0
- // @description Enables a disabled button on Torn profile page and redirects to the attack page when the button is clicked
- // @match https://www.torn.com/profiles.php?XID=*
- // ==/UserScript==
- (function() {
- 'use strict';
- function enableButton(button) {
- if (button && button.classList.contains('disabled')) {
- button.classList.remove('disabled');
- button.classList.add('active');
- button.removeAttribute('aria-disabled');
- button.removeAttribute('href');
- button.addEventListener('click', handleButtonClick);
- }
- }
- function handleButtonClick(event) {
- event.preventDefault();
- // Get the user ID from the button's ID
- const userID = event.target.id.replace('button0-profile-', '');
- // Redirect to the attack page with the user ID
- window.location.href = `https://www.torn.com/loader.php?sid=attack&user2ID=${userID}`;
- }
- const checkButtonAvailability = setInterval(function() {
- const buttons = document.querySelectorAll('[id^="button0-profile-"]');
- if (buttons.length > 0) {
- clearInterval(checkButtonAvailability);
- buttons.forEach(enableButton);
- }
- }, 1000);
- })();