Advertisement
MeKLiN2

Untitled

Jan 25th, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. // ==UserScript==
  2. // @name verify
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-01-25
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://stumblechat.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=stumblechat.com
  9. // @grant none
  10. // @run-at document-end
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Function to click the VERIFY button
  17. function clickVerifyButton() {
  18. console.log('clickVerifyButton function called...');
  19. const verifyButton = document.querySelector('#modal > span > #interact');
  20. if (verifyButton) {
  21. console.log('VERIFY button found...');
  22. if (verifyButton.offsetParent !== null) {
  23. console.log('VERIFY button is visible. Clicking the button...');
  24. verifyButton.click();
  25. } else {
  26. console.log('VERIFY button is not visible.');
  27. }
  28. } else {
  29. console.log('VERIFY button not found.');
  30. }
  31. }
  32.  
  33. // Function to observe DOM changes
  34. function observeDOM() {
  35. console.log('Setting up MutationObserver...');
  36. const observer = new MutationObserver((mutationsList) => {
  37. console.log(`Mutation observed... ${mutationsList.length} mutation(s) in total.`);
  38. for (const mutation of mutationsList) {
  39. console.log(`Mutation type: ${mutation.type}`);
  40. console.log(`Mutation target: ${mutation.target.outerHTML}`);
  41. console.log(`Added nodes: ${mutation.addedNodes.length}`);
  42. mutation.addedNodes.forEach((node) => {
  43. console.log(`Added node: ${node.nodeName}`);
  44. });
  45. console.log(`Removed nodes: ${mutation.removedNodes.length}`);
  46. mutation.removedNodes.forEach((node) => {
  47. console.log(`Removed node: ${node.nodeName}`);
  48. });
  49. if (mutation.type === 'childList' && mutation.target.id === 'modal') {
  50. console.log('Child list changed in the modal element...');
  51. // Check if the VERIFY button becomes available in the modal
  52. clickVerifyButton();
  53. }
  54. }
  55. });
  56.  
  57. // Start observing changes in the sc-modal element
  58. console.log('Attempting to observe sc-modal element...');
  59. const scModal = document.querySelector('#modal');
  60. if (scModal) {
  61. console.log('sc-modal element found. Starting observation...');
  62. observer.observe(scModal, { childList: true, subtree: true });
  63. } else {
  64. console.log('sc-modal element not found.');
  65. }
  66. }
  67.  
  68. // Start observing DOM changes
  69. console.log('Script started. Observing DOM changes...');
  70. observeDOM();
  71. })();
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement