Doobie's Button Bypass

Enables attack button when user is in hospital on profile page and mini attack buttons (when holding left click on username) Mail me if you have issues

  1. // ==UserScript==
  2. // @name Doobie's Button Bypass
  3. // @namespace http://tampermonkey.net/DoobiesButtonBypass
  4. // @version 2.1
  5. // @description Enables attack button when user is in hospital on profile page and mini attack buttons (when holding left click on username) Mail me if you have issues
  6. // @match https://www.torn.com/profiles.php*
  7. // @match https://www.torn.com/factions.php*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function updateAttackButton(button) {
  15. if (button && button.classList.contains('disabled')) {
  16. button.classList.remove('disabled');
  17. button.classList.add('active');
  18. button.style.pointerEvents = 'auto';
  19. button.style.opacity = '1';
  20. button.setAttribute('aria-label', 'Attack (Bypass Hospital Restriction)');
  21.  
  22. if (window.location.href.includes('profiles.php')) {
  23. let svgIcon = button.querySelector('svg');
  24. if (svgIcon) {
  25. svgIcon.style.filter = 'none';
  26. svgIcon.style.fill = '#cf3b13';
  27. }
  28. }
  29.  
  30. if (button.querySelector('svg')) {
  31. let svgIcon = button.querySelector('svg');
  32. if (svgIcon) {
  33. svgIcon.style.filter = 'none';
  34. svgIcon.style.fill = '#cf3b13';
  35. }
  36. }
  37.  
  38. button.addEventListener('click', function(e) {
  39. e.preventDefault();
  40. window.location.href = button.getAttribute('href');
  41. });
  42. }
  43. }
  44.  
  45. function enableProfileAttackButtons() {
  46. const profileAttackButton = document.querySelector('.profile-button-attack.disabled');
  47. if (profileAttackButton) updateAttackButton(profileAttackButton);
  48.  
  49. const miniAttackButtons = document.querySelectorAll('a.profile-button-attack.disabled');
  50. miniAttackButtons.forEach(button => updateAttackButton(button));
  51. }
  52.  
  53. function enableFactionWarAttackButtons() {
  54. const miniAttackButtonsOnWar = document.querySelectorAll('a.profile-button-attack.disabled');
  55. miniAttackButtonsOnWar.forEach(button => updateAttackButton(button));
  56. }
  57.  
  58. function initializeObserver() {
  59. const observer = new MutationObserver(function(mutations) {
  60. mutations.forEach(function(mutation) {
  61. if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
  62. mutation.addedNodes.forEach(function(node) {
  63. if (node.nodeType === 1) {
  64. if (window.location.href.includes('profiles.php')) {
  65. enableProfileAttackButtons();
  66. } else if (window.location.href.includes('factions.php')) {
  67. enableFactionWarAttackButtons();
  68. }
  69. }
  70. });
  71. }
  72. });
  73. });
  74. observer.observe(document.body, { childList: true, subtree: true });
  75. }
  76.  
  77. window.onload = function() {
  78. if (window.location.href.includes('profiles.php')) {
  79. enableProfileAttackButtons();
  80. } else if (window.location.href.includes('factions.php')) {
  81. enableFactionWarAttackButtons();
  82. }
  83. initializeObserver();
  84. };
  85.  
  86. })();
  87.  
  88. // Made with Love by DoobieSuckin [3255641]

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址