Advertisement
MeKLiN2

unlisted HSS hell stumblechat script

Nov 8th, 2024
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.10 KB | None | 0 0
  1. // ==UserScript==
  2. // @name HSS
  3. // @namespace http://tampermonkey.net/
  4. // @version BETA2
  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('message-window');
  310. systemMessageWindow.classList.add('system-message-window');
  311. systemMessageWindow.style.position = 'fixed';
  312. systemMessageWindow.style.top = '20px';
  313. systemMessageWindow.style.right = '20px';
  314. systemMessageWindow.style.background = 'rgba(255, 255, 255, 0.9)';
  315. systemMessageWindow.style.border = '1px solid #ccc';
  316. systemMessageWindow.style.padding = '10px';
  317. systemMessageWindow.style.cursor = 'move';
  318. systemMessageWindow.style.maxWidth = '400px'; // Limit the width to prevent infinite length
  319. systemMessageWindow.style.overflowY = 'auto'; // Add scrollbar
  320. systemMessageWindow.style.maxHeight = '200px'; // Limit height to enable scrollbar
  321. systemMessageWindow.innerHTML = 'System Messages Window';
  322.  
  323. // Add auto-scroll functionality
  324. systemMessageWindow.addEventListener('DOMNodeInserted', () => {
  325. systemMessageWindow.scrollTop = systemMessageWindow.scrollHeight;
  326. });
  327.  
  328. // Minimize button
  329. const minimizeButton = document.createElement('button');
  330. minimizeButton.textContent = 'Minimize';
  331. minimizeButton.style.position = 'absolute';
  332. minimizeButton.style.top = '5px';
  333. minimizeButton.style.right = '5px';
  334. minimizeButton.addEventListener('click', () => {
  335. systemMessageWindow.style.display = 'none';
  336. });
  337. systemMessageWindow.appendChild(minimizeButton);
  338.  
  339. // Make the window draggable
  340. let isDragging = false;
  341. let offsetX, offsetY;
  342. systemMessageWindow.addEventListener('mousedown', e => {
  343. isDragging = true;
  344. const rect = systemMessageWindow.getBoundingClientRect();
  345. offsetX = e.clientX - rect.left;
  346. offsetY = e.clientY - rect.top;
  347. });
  348.  
  349. document.addEventListener('mousemove', e => {
  350. if (isDragging) {
  351. const x = e.clientX - offsetX;
  352. const y = e.clientY - offsetY;
  353. const maxX = window.innerWidth - systemMessageWindow.offsetWidth;
  354. const maxY = window.innerHeight - systemMessageWindow.offsetHeight;
  355. systemMessageWindow.style.left = `${Math.min(Math.max(0, x), maxX)}px`;
  356. systemMessageWindow.style.top = `${Math.min(Math.max(0, y), maxY)}px`;
  357. }
  358. });
  359.  
  360. document.addEventListener('mouseup', () => {
  361. isDragging = false;
  362. });
  363.  
  364. // Append the window to the body
  365. document.body.appendChild(systemMessageWindow);
  366.  
  367. // Observe mutations in the chat content
  368. const observer = new MutationObserver(mutationsList => {
  369. mutationsList.forEach(mutation => {
  370. mutation.addedNodes.forEach(node => {
  371. if (node instanceof HTMLElement && node.classList.contains('message') && node.classList.contains('system')) {
  372. // Move the system message to the system message window
  373. const messageText = node.innerText.trim();
  374. const messageElement = document.createElement('div');
  375. messageElement.textContent = messageText;
  376. systemMessageWindow.appendChild(messageElement);
  377. // Hide the system message in the main chat box
  378. node.style.display = 'none';
  379. }
  380. });
  381. });
  382. });
  383.  
  384. const chatContent = document.querySelector('#chat-content');
  385. if (chatContent) {
  386. observer.observe(chatContent, { childList: true });
  387. } else {
  388. console.error('Chat content not found.');
  389. }
  390. }
  391. }
  392.  
  393. // Start the SystemMessages script
  394. new SystemMessages();
  395.  
  396.  
  397.  
  398. class UserMessages {
  399. constructor() {
  400. this.setupUserMessageWindow();
  401. }
  402.  
  403. setupUserMessageWindow() {
  404. const userMessageWindow = document.createElement('div');
  405. userMessageWindow.classList.add('message-window');
  406. userMessageWindow.classList.add('user-message-window');
  407. userMessageWindow.style.position = 'fixed';
  408. userMessageWindow.style.top = '20px';
  409. userMessageWindow.style.left = '20px'; // Adjusted position for user messages
  410. userMessageWindow.style.background = 'rgba(255, 255, 255, 0.9)';
  411. userMessageWindow.style.border = '1px solid #ccc';
  412. userMessageWindow.style.padding = '10px';
  413. userMessageWindow.style.cursor = 'move';
  414. userMessageWindow.style.maxWidth = '400px'; // Limit the width to prevent infinite length
  415. userMessageWindow.style.overflowY = 'auto'; // Add scrollbar
  416. userMessageWindow.style.maxHeight = '200px'; // Limit height to enable scrollbar
  417. userMessageWindow.innerHTML = 'User Messages Window';
  418.  
  419. // Add auto-scroll functionality
  420. userMessageWindow.addEventListener('DOMNodeInserted', () => {
  421. userMessageWindow.scrollTop = userMessageWindow.scrollHeight;
  422. });
  423.  
  424. // Minimize button
  425. const minimizeButton = document.createElement('button');
  426. minimizeButton.textContent = 'Minimize';
  427. minimizeButton.style.position = 'absolute';
  428. minimizeButton.style.top = '5px';
  429. minimizeButton.style.right = '5px';
  430. minimizeButton.addEventListener('click', () => {
  431. userMessageWindow.style.display = 'none';
  432. });
  433. userMessageWindow.appendChild(minimizeButton);
  434.  
  435. // Make the window draggable
  436. let isDragging = false;
  437. let offsetX, offsetY;
  438. userMessageWindow.addEventListener('mousedown', e => {
  439. isDragging = true;
  440. const rect = userMessageWindow.getBoundingClientRect();
  441. offsetX = e.clientX - rect.left;
  442. offsetY = e.clientY - rect.top;
  443. });
  444.  
  445. document.addEventListener('mousemove', e => {
  446. if (isDragging) {
  447. const x = e.clientX - offsetX;
  448. const y = e.clientY - offsetY;
  449. const maxX = window.innerWidth - userMessageWindow.offsetWidth;
  450. const maxY = window.innerHeight - userMessageWindow.offsetHeight;
  451. userMessageWindow.style.left = `${Math.min(Math.max(0, x), maxX)}px`;
  452. userMessageWindow.style.top = `${Math.min(Math.max(0, y), maxY)}px`;
  453. }
  454. });
  455.  
  456. document.addEventListener('mouseup', () => {
  457. isDragging = false;
  458. });
  459.  
  460. // Append the window to the body
  461. document.body.appendChild(userMessageWindow);
  462.  
  463. // Observe mutations in the chat content
  464. const observer = new MutationObserver(mutationsList => {
  465. mutationsList.forEach(mutation => {
  466. mutation.addedNodes.forEach(node => {
  467. if (node instanceof HTMLElement && node.classList.contains('message') && node.classList.contains('common')) {
  468. // Check if the added node is a common message and from the user "u_u"
  469. const nicknameElement = node.querySelector('.nickname');
  470. if (nicknameElement && nicknameElement.innerText.trim() === 'u_u') {
  471. const messageText = node.innerText.trim();
  472. const messageElement = document.createElement('div');
  473. messageElement.textContent = messageText;
  474. userMessageWindow.appendChild(messageElement);
  475. // Hide the user's message in the main chat box
  476. node.style.display = 'none';
  477. }
  478. }
  479. });
  480. });
  481. });
  482.  
  483. const chatContent = document.querySelector('#chat-content');
  484. if (chatContent) {
  485. observer.observe(chatContent, { childList: true });
  486. } else {
  487. console.error('Chat content not found.');
  488. }
  489. }
  490. }
  491.  
  492. // Start the UserMessages script
  493. new UserMessages();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement