Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name HSSCharlie
- // @namespace http://tampermonkey.net/
- // @version 2024-01-28
- // @description try to take over the world!
- // @author You
- // @match https://stumblechat.com/room/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=stumblechat.com
- // @grant GM_setClipboard
- // ==/UserScript==
- (function() {
- 'use strict';
- // Intercept WebSocket constructor to extract WebSocket URL
- const originalWebSocket = window.WebSocket;
- window.WebSocket = function(url, protocols) {
- // Call original constructor
- const ws = new originalWebSocket(url, protocols);
- // Log WebSocket URL
- console.log('WebSocket URL:', url);
- // Return WebSocket object
- return ws;
- };
- // Function to display WebSocket URL in a DIV
- function displayWebSocketURL(webSocketURL) {
- // Create a DIV to display WebSocket URL
- const div = document.createElement('div');
- div.style.cssText = 'position: fixed; top: 20px; left: 20px; z-index: 9999; background-color: white; border: 1px solid black; padding: 10px; max-height: 200px; overflow-y: auto;';
- div.innerHTML = `
- <p>WebSocket URL:</p>
- <textarea id="webSocketURL" readonly style="width: 100%; height: 100px; margin-bottom: 10px;">${webSocketURL}</textarea>
- <button id="saveButton">Save to Clipboard</button>
- `;
- document.body.appendChild(div);
- // Add event listener to save button
- const saveButton = div.querySelector('#saveButton');
- saveButton.addEventListener('click', () => {
- const webSocketURLTextArea = div.querySelector('#webSocketURL');
- GM_setClipboard(webSocketURLTextArea.value);
- alert('WebSocket URL copied to clipboard!');
- });
- }
- // Call the function to display WebSocket URL
- displayWebSocketURL('wss://wss1.stumblechat.com/'); // Assuming a static URL for demonstration
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement