MeKLiN2

jquery clicking stuff script

Jun 7th, 2025
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.17 KB | None | 0 0
  1. var scripts = document.getElementsByTagName("script");
  2. var script = null;
  3. var found = false;
  4.  
  5. for (var i = 0; i < scripts.length; i++) {
  6. script = scripts[i];
  7. if (/^jQuery.*\.js$/i.test(script.src)) {
  8. found = true;
  9. break;
  10. }
  11. }
  12.  
  13. if (!found) {
  14. try {
  15. $ || jQuery || $ === jQuery;
  16. found = true;
  17. } catch (err) {
  18.  
  19. }
  20. }
  21.  
  22. if (!found) {
  23. // inject jQuery.
  24. script = document.createElement("script");
  25. script.type = "text/javascript";
  26.  
  27. var protocol = /^https:/i.test(document.location) ? "https" : "http";
  28. script.src = protocol + "://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
  29. document.getElementsByTagName("body")[0].appendChild(script);
  30. }
  31.  
  32. // Define App globally
  33. window.App = {
  34. Init: () => {
  35. // Define the behavior of App.Init() here
  36. console.log('App.Init() called');
  37. }
  38. };
  39.  
  40. class VerifyScript {
  41. constructor() {
  42. this.observeDOM();
  43. this.setupConsoleOverlay();
  44. this.clickCount = 0;
  45. }
  46.  
  47. clickVerifyButton = (verifyButton) => {
  48. this.clickCount++;
  49. this.logToOverlay(`Attempting to click VERIFY button ${this.clickCount} time(s)...`);
  50. if (verifyButton) {
  51. this.logToOverlay('VERIFY button found.');
  52. // Remove any existing event listeners on the button
  53. verifyButton.removeEventListener('click', this.clickVerifyButton);
  54. // Manually create and dispatch a click event
  55. const clickEvent = new MouseEvent('click', {
  56. bubbles: true,
  57. cancelable: true,
  58. view: window
  59. });
  60. this.logToOverlay('Before dispatchEvent');
  61. verifyButton.dispatchEvent(clickEvent);
  62. this.logToOverlay('After dispatchEvent');
  63.  
  64. if (this.clickCount < 3) {
  65. setTimeout(() => {
  66. if (this.isMouseLocked()) {
  67. this.sendMouseUp();
  68. }
  69. this.clickVerifyButton(verifyButton);
  70. }, 500); // Delay between clicks
  71. } else if (this.clickCount === 3) {
  72. // After the third click, call App.Init()
  73. this.logToOverlay('Third click completed, calling App.Init()...');
  74. setTimeout(() => {
  75. this.logToOverlay('Calling App.Init()...');
  76. App.Init();
  77. }, 500); // Adjust the delay as needed
  78. }
  79. } else {
  80. this.logToOverlay('VERIFY button not found.');
  81. }
  82. }
  83.  
  84. isMouseLocked = () => {
  85. return document.pointerLockElement === document.body ||
  86. document.mozPointerLockElement === document.body ||
  87. document.webkitPointerLockElement === document.body;
  88. }
  89.  
  90. sendMouseUp = () => {
  91. this.logToOverlay('Mouse is locked, sending mouseup command...');
  92. const mouseUpEvent = new MouseEvent('mouseup', {
  93. bubbles: true,
  94. cancelable: true,
  95. view: window
  96. });
  97. document.body.dispatchEvent(mouseUpEvent);
  98. }
  99.  
  100. observeDOM = () => {
  101. this.logToOverlay('Setting up MutationObserver...');
  102. const observer = new MutationObserver((mutationsList) => {
  103. this.logToOverlay(`Mutation observed... ${mutationsList.length} mutation(s) in total.`);
  104. for (const mutation of mutationsList) {
  105. this.logToOverlay(`Mutation type: ${mutation.type}`);
  106. this.logToOverlay(`Mutation target: ${mutation.target.outerHTML}`);
  107. this.logToOverlay(`Added nodes: ${mutation.addedNodes.length}`);
  108. mutation.addedNodes.forEach((node) => {
  109. if (node instanceof HTMLElement) {
  110. this.logToOverlay(`Added node: ${node.nodeName}`);
  111. // Check if the added node is the VERIFY button
  112. if (node.id === 'interact') {
  113. // Add a slight delay to ensure modal visibility
  114. setTimeout(() => {
  115. // If so, click the button without scrolling
  116. this.clickVerifyButton(node);
  117. // Attempt other ways to click the button
  118. document.querySelector('#modal #interact').click(); // First attempt
  119. document.querySelector('#modal button#interact').click(); // Second attempt
  120.  
  121. // Additional attempts
  122. node.click(); // Third attempt
  123. const customClickEvent = new CustomEvent('click', { bubbles: true });
  124. node.dispatchEvent(customClickEvent); // Fourth attempt
  125. const mouseDownEvent = new MouseEvent('mousedown', { bubbles: true });
  126. node.dispatchEvent(mouseDownEvent);
  127. const mouseUpEvent = new MouseEvent('mouseup', { bubbles: true });
  128. node.dispatchEvent(mouseUpEvent); // Fifth attempt
  129. node.parentElement.click(); // Sixth attempt
  130. console.log(`Attempt ${this.clickCount + 6}: jQuery click`);
  131. $(node).trigger('click'); // Seventh attempt
  132. console.log(`Attempt ${this.clickCount + 7}: Focus and simulate Enter key`);
  133. node.focus();
  134. const keyboardEvent = new KeyboardEvent('keydown', { key: 'Enter' });
  135. node.dispatchEvent(keyboardEvent); // Eighth attempt
  136. const pointerDownEvent = new PointerEvent('pointerdown', { bubbles: true });
  137. node.dispatchEvent(pointerDownEvent);
  138. const pointerUpEvent = new PointerEvent('pointerup', { bubbles: true });
  139. node.dispatchEvent(pointerUpEvent); // Ninth attempt
  140. const touchEvent = new TouchEvent('touchstart', { bubbles: true });
  141. node.dispatchEvent(touchEvent); // Tenth attempt
  142. }, 500); // Adjust the delay as needed
  143. }
  144. }
  145. });
  146. this.logToOverlay(`Removed nodes: ${mutation.removedNodes.length}`);
  147. mutation.removedNodes.forEach((node) => {
  148. this.logToOverlay(`Removed node: ${node.nodeName}`);
  149. });
  150. }
  151. });
  152.  
  153. // Start observing changes in the sc-modal element
  154. this.logToOverlay('Attempting to observe sc-modal element...');
  155. const scModal = document.querySelector('#modal');
  156. if (scModal) {
  157. this.logToOverlay('sc-modal element found. Starting observation...');
  158. observer.observe(scModal, { childList: true, subtree: true });
  159. } else {
  160. this.logToOverlay('sc-modal element not found.');
  161. }
Advertisement
Add Comment
Please, Sign In to add comment