Advertisement
MeKLiN2

hss 1234

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