您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a button to toggle the width of the chat and the size of images on StumbleChat rooms
当前为
// ==UserScript== // @name StumbleChat Width Toggle // @namespace http://tampermonkey.net/ // @version 0.4 // @description Adds a button to toggle the width of the chat and the size of images on StumbleChat rooms // @author You // @match https://stumblechat.com/room/* // @grant none // ==/UserScript== (function() { 'use strict'; // Select the sc-chat element var chatElement = document.querySelector('sc-chat'); // Check if the element exists if (chatElement) { // Create a button element for box size var boxSizeButton = document.createElement('button'); boxSizeButton.innerText = 'Box Size'; boxSizeButton.style.position = 'fixed'; boxSizeButton.style.top = '10px'; boxSizeButton.style.right = '20px'; boxSizeButton.style.zIndex = '1000'; boxSizeButton.style.color = 'black'; boxSizeButton.style.background = '#33FF3380'; boxSizeButton.style.borderRadius = '5px'; // Add the button to the document document.body.appendChild(boxSizeButton); // Add a click event listener to the box size button boxSizeButton.addEventListener('click', function() { // Toggle the width of the chat if (chatElement.style.width === '2000px') { chatElement.style.width = '500px'; } else { chatElement.style.width = '2000px'; // Set the width and height of images in the message-content class to twice their current size var images = document.querySelectorAll('.message-content img'); images.forEach(function(image) { image.width *= 2; image.height *= 2; }); } }); // Create a button element for font size var fontSizeButton = document.createElement('button'); fontSizeButton.innerText = 'Font Size'; fontSizeButton.style.position = 'fixed'; fontSizeButton.style.top = '10px'; fontSizeButton.style.right = '120px'; fontSizeButton.style.zIndex = '1000'; fontSizeButton.style.color = 'black'; fontSizeButton.style.background = '#33FF3380'; fontSizeButton.style.borderRadius = '5px'; // Add the button to the document document.body.appendChild(fontSizeButton); // Add a click event listener to the font size button fontSizeButton.addEventListener('click', function() { // Select all elements with the message class var messages = document.querySelectorAll('.message'); // Toggle the font size of the messages messages.forEach(function(message) { if (message.style.fontSize === '1.5rem') { message.style.fontSize = '1rem'; } else { message.style.fontSize = '1.5rem'; } }); }); } })();