Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name verify
- // @namespace http://tampermonkey.net/
- // @version 2024-01-25
- // @description try to take over the world!
- // @author You
- // @match https://stumblechat.com/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=stumblechat.com
- // @grant none
- // @run-at document-end
- // ==/UserScript==
- (function() {
- 'use strict';
- // Function to click the VERIFY button
- function clickVerifyButton() {
- console.log('clickVerifyButton function called...');
- const verifyButton = document.querySelector('#modal > span > #interact');
- if (verifyButton) {
- console.log('VERIFY button found...');
- if (verifyButton.offsetParent !== null) {
- console.log('VERIFY button is visible. Clicking the button...');
- verifyButton.click();
- } else {
- console.log('VERIFY button is not visible.');
- }
- } else {
- console.log('VERIFY button not found.');
- }
- }
- // Function to observe DOM changes
- function observeDOM() {
- console.log('Setting up MutationObserver...');
- const observer = new MutationObserver((mutationsList) => {
- console.log(`Mutation observed... ${mutationsList.length} mutation(s) in total.`);
- for (const mutation of mutationsList) {
- console.log(`Mutation type: ${mutation.type}`);
- console.log(`Mutation target: ${mutation.target.outerHTML}`);
- console.log(`Added nodes: ${mutation.addedNodes.length}`);
- mutation.addedNodes.forEach((node) => {
- console.log(`Added node: ${node.nodeName}`);
- });
- console.log(`Removed nodes: ${mutation.removedNodes.length}`);
- mutation.removedNodes.forEach((node) => {
- console.log(`Removed node: ${node.nodeName}`);
- });
- if (mutation.type === 'childList' && mutation.target.id === 'modal') {
- console.log('Child list changed in the modal element...');
- // Check if the VERIFY button becomes available in the modal
- clickVerifyButton();
- }
- }
- });
- // Start observing changes in the sc-modal element
- console.log('Attempting to observe sc-modal element...');
- const scModal = document.querySelector('#modal');
- if (scModal) {
- console.log('sc-modal element found. Starting observation...');
- observer.observe(scModal, { childList: true, subtree: true });
- } else {
- console.log('sc-modal element not found.');
- }
- }
- // Start observing DOM changes
- console.log('Script started. Observing DOM changes...');
- observeDOM();
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement