Drawaria Keep Buttons Enabled

Mantiene los botones siempre habilitados

目前为 2025-01-11 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Drawaria Keep Buttons Enabled
  3. // @namespace http://tampermonkey.net/
  4. // @version 11-1-2025
  5. // @description Mantiene los botones siempre habilitados
  6. // @author YouTube
  7. // @match https://drawaria.online/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=drawaria.online
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Función para eliminar el atributo 'required' de los campos del formulario
  17. function removeRequiredAttributes() {
  18. // Seleccionar el campo de selección (dropdown)
  19. const reportReasonSelect = document.getElementById('report-reason');
  20. if (reportReasonSelect) {
  21. reportReasonSelect.removeAttribute('required');
  22. }
  23.  
  24. // Seleccionar el campo de texto (textarea)
  25. const reportCommentsTextarea = document.getElementById('report-comments');
  26. if (reportCommentsTextarea) {
  27. reportCommentsTextarea.removeAttribute('required');
  28. }
  29. }
  30.  
  31. // Función para mantener los botones habilitados
  32. function keepButtonsEnabled() {
  33. const buttons = document.querySelectorAll(
  34. 'button.btn.btn-primary.btn-block.pgdrawbutton,' +
  35. 'button.btn.btn-primary.btn-block.spawnavatarbutton,' +
  36. 'button#sendtogallery,' +
  37. 'button.btn.btn-light.btn-block.btn-sm.kickbutton,' +
  38. 'button.btn.btn-light.btn-block.btn-sm.hidedrawing,' +
  39. 'button.btn.btn-light.btn-block.btn-sm.mutebutton,' +
  40. 'button.btn.btn-light.btn-block.btn-sm.reportbutton,' +
  41. 'button#roomlist-refresh' // Added the new button
  42. );
  43. buttons.forEach(button => {
  44. button.disabled = false;
  45. button.removeAttribute('disabled');
  46. button.style.pointerEvents = 'auto'; // Asegura que el botón sea clickeable
  47. });
  48. }
  49.  
  50. // Función para mantener el popover-body visible
  51. function keepPopoverBodyVisible() {
  52. const popoverBody = document.querySelector('.popover-body');
  53. if (popoverBody) {
  54. popoverBody.style.display = 'block';
  55. }
  56. }
  57.  
  58. // Ejecutar las funciones inicialmente
  59. keepButtonsEnabled();
  60. keepPopoverBodyVisible();
  61.  
  62. // Observar cambios en el DOM para mantener los botones habilitados y el popover-body visible
  63. const observer = new MutationObserver(() => {
  64. keepButtonsEnabled();
  65. keepPopoverBodyVisible();
  66. });
  67. observer.observe(document.body, { childList: true, subtree: true, attributes: true });
  68.  
  69. // También puedes agregar un intervalo para asegurarte de que los botones y el popover-body se mantengan habilitados/visibles
  70. setInterval(() => {
  71. keepButtonsEnabled();
  72. keepPopoverBodyVisible();
  73. }, 1000);
  74.  
  75. // Interceptar el evento click para asegurar que los botones siempre estén habilitados
  76. document.addEventListener('click', function(event) {
  77. if (event.target && event.target.matches(
  78. 'button.btn.btn-primary.btn-block.pgdrawbutton,' +
  79. 'button.btn.btn-primary.btn-block.spawnavatarbutton,' +
  80. 'button#sendtogallery,' +
  81. 'button.btn.btn-light.btn-block.btn-sm.kickbutton,' +
  82. 'button.btn.btn-light.btn-block.btn-sm.hidedrawing,' +
  83. 'button.btn.btn-light.btn-block.btn-sm.mutebutton,' +
  84. 'button.btn.btn-light.btn-block.btn-sm.reportbutton,' +
  85. 'button#roomlist-refresh' // Added the new button
  86. )) {
  87. event.target.disabled = false;
  88. event.target.removeAttribute('disabled');
  89. event.target.style.pointerEvents = 'auto';
  90. }
  91. }, true);
  92.  
  93. // Ejecutar la función cuando el DOM esté completamente cargado
  94. if (document.readyState === 'loading') {
  95. document.addEventListener('DOMContentLoaded', function() {
  96. removeRequiredAttributes();
  97. // Esperar a que el modal se abra y luego simular el clic
  98. const modal = document.querySelector('.modal-dialog');
  99. if (modal) {
  100. const observer = new MutationObserver(function(mutations) {
  101. mutations.forEach(function(mutation) {
  102. if (mutation.attributeName === 'class' && modal.classList.contains('show')) {
  103. }
  104. });
  105. });
  106. observer.observe(modal, { attributes: true });
  107. }
  108. });
  109. } else {
  110. removeRequiredAttributes();
  111. // Esperar a que el modal se abra y luego simular el clic
  112. const modal = document.querySelector('.modal-dialog');
  113. if (modal) {
  114. const observer = new MutationObserver(function(mutations) {
  115. mutations.forEach(function(mutation) {
  116. if (mutation.attributeName === 'class' && modal.classList.contains('show')) {
  117. }
  118. });
  119. });
  120. observer.observe(modal, { attributes: true });
  121. }
  122. }
  123. })();