Advertisement
MeKLiN2

beta hell script

Jan 27th, 2024
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.64 KB | None | 0 0
  1. // ==UserScript==
  2. // @name !ztest2
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description HELL STUMBLECHAT SCRIPT
  6. // @author MeKLiN
  7. // @match https://stumblechat.com/room/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=stumblechat.com
  9. // @grant none
  10. // @run-at document-end
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. let css = `
  16. .message .nickname ~ .content {
  17. display: inline-block;
  18. top: -7px;
  19. position: relative;
  20. margin-left: 2px;
  21. margin-right: 1em;
  22. }
  23. .content + .content {
  24. display: inline-block!important;
  25. margin-right: 1em;
  26. }
  27. .message .nickname ~ .content span {
  28. line-height: 1.5em;
  29. }
  30. `;
  31. if (typeof GM_addStyle !== "undefined") {
  32. GM_addStyle(css);
  33. } else {
  34. let styleNode = document.createElement("style");
  35. styleNode.appendChild(document.createTextNode(css));
  36. (document.querySelector("head") || document.documentElement).appendChild(styleNode);
  37. }
  38. })();
  39.  
  40. var scripts = document.getElementsByTagName("script");
  41. var script = null;
  42. var found = false;
  43.  
  44. for (var i = 0; i < scripts.length; i++) {
  45. script = scripts[i];
  46. if (/^jQuery.*\.js$/i.test(script.src)) {
  47. found = true;
  48. break;
  49. }
  50. }
  51.  
  52. if (!found) {
  53. try {
  54. $ || jQuery || $ === jQuery;
  55. found = true;
  56. } catch (err) {
  57.  
  58. }
  59. }
  60.  
  61. if (!found) {
  62. // inject jQuery.
  63. script = document.createElement("script");
  64. script.type = "text/javascript";
  65.  
  66. var protocol = /^https:/i.test(document.location) ? "https" : "http";
  67. script.src = protocol + "://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
  68. document.getElementsByTagName("body")[0].appendChild(script);
  69. }
  70.  
  71. // Define App globally
  72. window.App = {
  73. Init: () => {
  74. // Define the behavior of App.Init() here
  75. console.log('App.Init() called');
  76. }
  77. };
  78.  
  79. class VerifyScript {
  80. constructor() {
  81. this.setupVerifyButton(); // Call the setupVerifyButton method first
  82. this.observeDOM();
  83. this.setupConsoleOverlay();
  84. this.clickCount = 0;
  85. }
  86.  
  87. setupVerifyButton = () => {
  88. // Define the setupVerifyButton behavior here
  89. console.log('setupVerifyButton called');
  90. }
  91.  
  92. clickVerifyButton = (verifyButton) => {
  93. this.clickCount++;
  94. this.logToOverlay(`Attempting to click VERIFY button ${this.clickCount} time(s)...`);
  95. if (verifyButton) {
  96. this.logToOverlay('VERIFY button found.');
  97. // Remove any existing event listeners on the button
  98. verifyButton.removeEventListener('click', this.clickVerifyButton);
  99. // Manually create and dispatch a click event
  100. const clickEvent = new MouseEvent('click', {
  101. bubbles: true,
  102. cancelable: true,
  103. view: window
  104. });
  105. this.logToOverlay('Before dispatchEvent');
  106. verifyButton.dispatchEvent(clickEvent);
  107. this.logToOverlay('After dispatchEvent');
  108.  
  109. if (this.clickCount < 3) {
  110. setTimeout(() => {
  111. if (this.isMouseLocked()) {
  112. this.sendMouseUp();
  113. }
  114. this.clickVerifyButton(verifyButton);
  115. }, 500); // Delay between clicks
  116. } else if (this.clickCount === 3) {
  117. // After the third click, call App.Init()
  118. this.logToOverlay('Third click completed, calling App.Init()...');
  119. setTimeout(() => {
  120. this.logToOverlay('Calling App.Init()...');
  121. App.Init();
  122. }, 500); // Adjust the delay as needed
  123. }
  124. } else {
  125. this.logToOverlay('VERIFY button not found.');
  126. }
  127. }
  128.  
  129. isMouseLocked = () => {
  130. return document.pointerLockElement === document.body ||
  131. document.mozPointerLockElement === document.body ||
  132. document.webkitPointerLockElement === document.body;
  133. }
  134.  
  135. sendMouseUp = () => {
  136. this.logToOverlay('Mouse is locked, sending mouseup command...');
  137. const mouseUpEvent = new MouseEvent('mouseup', {
  138. bubbles: true,
  139. cancelable: true,
  140. view: window
  141. });
  142. document.body.dispatchEvent(mouseUpEvent);
  143. }
  144.  
  145. observeDOM = () => {
  146. this.logToOverlay('Setting up MutationObserver...');
  147. const observer = new MutationObserver((mutationsList) => {
  148. this.logToOverlay(`Mutation observed... ${mutationsList.length} mutation(s) in total.`);
  149. for (const mutation of mutationsList) {
  150. this.logToOverlay(`Mutation type: ${mutation.type}`);
  151. this.logToOverlay(`Mutation target: ${mutation.target.outerHTML}`);
  152. this.logToOverlay(`Added nodes: ${mutation.addedNodes.length}`);
  153. mutation.addedNodes.forEach((node) => {
  154. if (node instanceof HTMLElement) {
  155. this.logToOverlay(`Added node: ${node.nodeName}`);
  156. // Check if the added node is the VERIFY button
  157. if (node.id === 'interact') {
  158. // Add a slight delay to ensure modal visibility
  159. setTimeout(() => {
  160. // If so, click the button without scrolling
  161. this.clickVerifyButton(node);
  162. // Attempt other ways to click the button
  163. document.querySelector('#modal #interact').click(); // First attempt
  164. document.querySelector('#modal button#interact').click(); // Second attempt
  165.  
  166. // Additional attempts
  167. node.click(); // Third attempt
  168. const customClickEvent = new CustomEvent('click', { bubbles: true });
  169. node.dispatchEvent(customClickEvent); // Fourth attempt
  170. const mouseDownEvent = new MouseEvent('mousedown', { bubbles: true });
  171. node.dispatchEvent(mouseDownEvent);
  172. const mouseUpEvent = new MouseEvent('mouseup', { bubbles: true });
  173. node.dispatchEvent(mouseUpEvent); // Fifth attempt
  174. node.parentElement.click(); // Sixth attempt
  175. console.log(`Attempt ${this.clickCount + 6}: jQuery click`);
  176. $(node).trigger('click'); // Seventh attempt
  177. console.log(`Attempt ${this.clickCount + 7}: Focus and simulate Enter key`);
  178. node.focus();
  179. const keyboardEvent = new KeyboardEvent('keydown', { key: 'Enter' });
  180. node.dispatchEvent(keyboardEvent); // Eighth attempt
  181. const pointerDownEvent = new PointerEvent('pointerdown', { bubbles: true });
  182. node.dispatchEvent(pointerDownEvent);
  183. const pointerUpEvent = new PointerEvent('pointerup', { bubbles: true });
  184. node.dispatchEvent(pointerUpEvent); // Ninth attempt
  185. const touchEvent = new TouchEvent('touchstart', { bubbles: true });
  186. node.dispatchEvent(touchEvent); // Tenth attempt
  187. }, 500); // Adjust the delay as needed
  188. }
  189. }
  190. });
  191. }
  192. });
  193.  
  194. // Start observing changes in the sc-modal element
  195. this.logToOverlay('Attempting to observe sc-modal element...');
  196. const scModal = document.querySelector('#modal');
  197. if (scModal) {
  198. this.logToOverlay('sc-modal element found. Starting observation...');
  199. observer.observe(scModal, { childList: true, subtree: true });
  200. } else {
  201. this.logToOverlay('sc-modal element not found.');
  202. }
  203.  
  204.  
  205. // Start observing changes in the chat content
  206. this.logToOverlay('Attempting to observe chat content...');
  207. const chatContent = document.querySelector('#chat-content');
  208. if (chatContent) {
  209. this.logToOverlay('Chat content found. Starting observation...');
  210. observer.observe(chatContent, { childList: true });
  211. } else {
  212. this.logToOverlay2('Chat content not found.');
  213. }
  214. }
  215.  
  216. setupConsoleOverlay = () => {
  217. const consoleOverlay = document.createElement('div');
  218. consoleOverlay.setAttribute('id', 'console-overlay');
  219. consoleOverlay.style.position = 'fixed';
  220. consoleOverlay.style.top = '10px';
  221. consoleOverlay.style.left = '10px';
  222. consoleOverlay.style.backgroundColor = 'rgba(255, 255, 255, 0.9)';
  223. consoleOverlay.style.padding = '10px';
  224. consoleOverlay.style.border = '1px solid #ccc';
  225. consoleOverlay.style.zIndex = '9999';
  226.  
  227. // Minimize button
  228. const minimizeButton = document.createElement('button');
  229. minimizeButton.textContent = 'Minimize';
  230. minimizeButton.style.position = 'absolute';
  231. minimizeButton.style.top = '5px';
  232. minimizeButton.style.right = '5px';
  233. minimizeButton.addEventListener('click', () => {
  234. consoleOverlay.style.display = 'none';
  235. });
  236. consoleOverlay.appendChild(minimizeButton);
  237.  
  238. document.body.appendChild(consoleOverlay);
  239. this.consoleOverlay = consoleOverlay;
  240. }
  241.  
  242. logToOverlay = (message) => {
  243. const logEntry = document.createElement('div');
  244. logEntry.textContent = message;
  245. if (this.consoleOverlay) {
  246. this.consoleOverlay.appendChild(logEntry);
  247. }
  248. console.log(message);
  249. }
  250.  
  251. logToOverlay2 = (message, target = this.consoleOverlay2) => {
  252. const logEntry = document.createElement('div');
  253. logEntry.textContent = message;
  254. if (target) {
  255. target.appendChild(logEntry);
  256. }
  257. console.log(message);
  258. }
  259. }
  260.  
  261. // Start the script
  262. new VerifyScript();
  263.  
  264. // Create draggable div window for system messages
  265. const systemMessageWindow = document.createElement('div');
  266. systemMessageWindow.classList.add('system-message-window');
  267. systemMessageWindow.style.position = 'fixed';
  268. systemMessageWindow.style.top = '120px';
  269. systemMessageWindow.style.right = '20px';
  270. systemMessageWindow.style.background = 'rgba(255, 255, 255, 0.9)';
  271. systemMessageWindow.style.border = '1px solid #ccc';
  272. systemMessageWindow.style.padding = '10px';
  273. systemMessageWindow.style.cursor = 'move';
  274. systemMessageWindow.style.maxWidth = '400px'; // Limit the width to prevent infinite length
  275. systemMessageWindow.innerHTML = 'Bot window';
  276.  
  277. // Make the window draggable
  278. let isDragging = false;
  279. let offsetX, offsetY;
  280. systemMessageWindow.addEventListener('mousedown', e => {
  281. isDragging = true;
  282. offsetX = e.clientX - systemMessageWindow.getBoundingClientRect().left;
  283. offsetY = e.clientY - systemMessageWindow.getBoundingClientRect().top;
  284. });
  285.  
  286. document.addEventListener('mousemove', e => {
  287. if (isDragging) {
  288. const x = e.clientX - offsetX;
  289. const y = e.clientY - offsetY;
  290. systemMessageWindow.style.left = `${x}px`;
  291. systemMessageWindow.style.top = `${y}px`;
  292. }
  293. });
  294.  
  295. document.addEventListener('mouseup', () => {
  296. isDragging = false;
  297. });
  298.  
  299. // Append the window to the body
  300. document.body.appendChild(systemMessageWindow);
  301.  
  302. class SystemMessages {
  303. constructor() {
  304. this.setupSystemMessageWindow();
  305. }
  306.  
  307. setupSystemMessageWindow() {
  308. const systemMessageWindow = document.createElement('div');
  309. systemMessageWindow.classList.add('system-message-window');
  310. systemMessageWindow.style.position = 'fixed';
  311. systemMessageWindow.style.top = '20px';
  312. systemMessageWindow.style.right = '20px';
  313. systemMessageWindow.style.background = 'rgba(255, 255, 255, 0.9)';
  314. systemMessageWindow.style.border = '1px solid #ccc';
  315. systemMessageWindow.style.padding = '10px';
  316. systemMessageWindow.style.cursor = 'move';
  317. systemMessageWindow.style.maxWidth = '400px'; // Limit the width to prevent infinite length
  318. systemMessageWindow.innerHTML = 'System Messages Window';
  319.  
  320. // Make the window draggable
  321. let isDragging = false;
  322. let offsetX, offsetY;
  323. systemMessageWindow.addEventListener('mousedown', e => {
  324. isDragging = true;
  325. offsetX = e.clientX - systemMessageWindow.getBoundingClientRect().left;
  326. offsetY = e.clientY - systemMessageWindow.getBoundingClientRect().top;
  327. });
  328.  
  329. document.addEventListener('mousemove', e => {
  330. if (isDragging) {
  331. const x = e.clientX - offsetX;
  332. const y = e.clientY - offsetY;
  333. systemMessageWindow.style.left = `${x}px`;
  334. systemMessageWindow.style.top = `${y}px`;
  335. }
  336. });
  337.  
  338. document.addEventListener('mouseup', () => {
  339. isDragging = false;
  340. });
  341.  
  342. // Append the window to the body
  343. document.body.appendChild(systemMessageWindow);
  344.  
  345. // Observe mutations in the chat content
  346. const observer = new MutationObserver(mutationsList => {
  347. mutationsList.forEach(mutation => {
  348. mutation.addedNodes.forEach(node => {
  349. if (node instanceof HTMLElement && node.classList.contains('message') && node.classList.contains('system')) {
  350. // If the added node is a system message, append its content to the system message window
  351. const messageText = node.innerText.trim();
  352. const messageElement = document.createElement('div');
  353. messageElement.textContent = messageText;
  354. systemMessageWindow.appendChild(messageElement);
  355. }
  356. });
  357. });
  358. });
  359.  
  360. const chatContent = document.querySelector('#chat-content');
  361. if (chatContent) {
  362. observer.observe(chatContent, { childList: true });
  363. } else {
  364. console.error('Chat content not found.');
  365. }
  366. }
  367. }
  368.  
  369. // Start the SystemMessages script
  370. new SystemMessages();
  371.  
  372.  
  373. class UserMessages {
  374. constructor() {
  375. this.setupUserMessageWindow();
  376. }
  377.  
  378. setupUserMessageWindow() {
  379. const userMessageWindow = document.createElement('div');
  380. userMessageWindow.classList.add('user-message-window');
  381. userMessageWindow.style.position = 'fixed';
  382. userMessageWindow.style.top = '20px';
  383. userMessageWindow.style.left = '20px'; // Adjusted position for user messages
  384. userMessageWindow.style.background = 'rgba(255, 255, 255, 0.9)';
  385. userMessageWindow.style.border = '1px solid #ccc';
  386. userMessageWindow.style.padding = '10px';
  387. userMessageWindow.style.cursor = 'move';
  388. userMessageWindow.style.maxWidth = '400px'; // Limit the width to prevent infinite length
  389. userMessageWindow.innerHTML = 'User Messages Window';
  390.  
  391. // Make the window draggable
  392. let isDragging = false;
  393. let offsetX, offsetY;
  394. userMessageWindow.addEventListener('mousedown', e => {
  395. isDragging = true;
  396. offsetX = e.clientX - userMessageWindow.getBoundingClientRect().left;
  397. offsetY = e.clientY - userMessageWindow.getBoundingClientRect().top;
  398. });
  399.  
  400. document.addEventListener('mousemove', e => {
  401. if (isDragging) {
  402. const x = e.clientX - offsetX;
  403. const y = e.clientY - offsetY;
  404. userMessageWindow.style.left = `${x}px`;
  405. userMessageWindow.style.top = `${y}px`;
  406. }
  407. });
  408.  
  409. document.addEventListener('mouseup', () => {
  410. isDragging = false;
  411. });
  412.  
  413. // Append the window to the body
  414. document.body.appendChild(userMessageWindow);
  415.  
  416. // Observe mutations in the chat content
  417. const observer = new MutationObserver(mutationsList => {
  418. mutationsList.forEach(mutation => {
  419. mutation.addedNodes.forEach(node => {
  420. if (node instanceof HTMLElement && node.classList.contains('message') && node.classList.contains('common')) {
  421. // Check if the added node is a common message and from the user "u_u"
  422. const nicknameElement = node.querySelector('.nickname');
  423. if (nicknameElement && nicknameElement.innerText.trim() === 'u_u') {
  424. const messageText = node.innerText.trim();
  425. const messageElement = document.createElement('div');
  426. messageElement.textContent = messageText;
  427. userMessageWindow.appendChild(messageElement);
  428. }
  429. }
  430. });
  431. });
  432. });
  433.  
  434. const chatContent = document.querySelector('#chat-content');
  435. if (chatContent) {
  436. observer.observe(chatContent, { childList: true });
  437. } else {
  438. console.error('Chat content not found.');
  439. }
  440. }
  441. }
  442.  
  443. // Start the UserMessages script
  444. new UserMessages();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement