Enables the attack button on mini profiles and profile pages
// ==UserScript==
// @name Torn Attack Button Enabler (Force Link)
// @description Enables the attack button on mini profiles and profile pages
// @version 1.5
// @author dingus
// @match https://www.torn.com/*
// @run-at document-start
// @grant none
// @namespace https://greasyfork.org/users/1571407
// ==/UserScript==
(function() {
'use strict';
const forceEnableButtons = () => {
const attackButtons = document.querySelectorAll('a.profile-button-attack');
attackButtons.forEach(btn => {
if (btn.classList.contains('disabled')) {
btn.classList.remove('disabled');
btn.classList.add('active');
btn.style.pointerEvents = 'auto';
btn.style.cursor = 'pointer';
}
const svg = btn.querySelector('svg.profile-mini-_disabled___dhYPV');
if (svg) {
svg.classList.remove('profile-mini-_disabled___dhYPV');
svg.style.filter = 'none';
svg.style.opacity = '1';
}
if (!btn.dataset.hacked) {
btn.dataset.hacked = "true";
btn.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
const targetUrl = btn.getAttribute('href');
if (targetUrl && targetUrl !== '#') {
window.location.href = targetUrl;
}
}, true);
}
});
};
const observer = new MutationObserver(() => forceEnableButtons());
observer.observe(document.documentElement, {
childList: true,
subtree: true
});
setInterval(forceEnableButtons, 1000);
forceEnableButtons();
})();