• We just launched and are currently in beta. Join us as we build and grow the community.

[SCRIPT] Add a button to the shoutbox

DeepLuck

Co-Op Specialist
D Rep
0
0
0
Rep
0
D Vouches
0
0
0
Vouches
0
Posts
92
Likes
41
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 200 XP
Hello users, I just made this script for @ to help him to use the shoutbox and did some fix in the code using GPT since he's in recover from an accident and I'm glad I could help. I wanted to share the code with you if you're interested to have a button near the emotes that sends a message.
It's not the best button, or the coolest
Code:
// ==UserScript==
// @name         Cracked.io Shoutbox Send Button
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Adds a send button to the shoutbox on cracked.io
// @author       Cracked.io/Alex
// @match        
// @grant        none
// ==/UserScript==
(function() {
'use strict';
// Function to simulate pressing the Enter key
function sendMessage() {
let messageInput = document.querySelector('#message_input');
if (messageInput && messageInput.value.trim().length > 0) {
let event = new KeyboardEvent('keypress', {
bubbles: true,
cancelable: true,
keyCode: 13
});
messageInput.dispatchEvent(event);
}
}
// Create the Send button
function addButton() {
let button = document.createElement('button');
button.innerHTML = 'Send';
button.style.position = 'relative';
button.style.marginLeft = '10px';
button.style.padding = '5px 10px';
button.style.backgroundColor = '#4E4E4E';
button.style.color = 'white';
button.style.border = 'none';
button.style.cursor = 'pointer';
button.style.borderRadius = '4px';
button.addEventListener('click', function() {
sendMessage();
});
// Add the button to the page
let inputContainer = document.querySelector('#shoutbox #message_input').parentElement;
if (inputContainer) {
inputContainer.appendChild(button);
}
}
// Wait for the shoutbox to load
function waitForShoutbox() {
let shoutbox = document.querySelector('#shoutbox');
if (shoutbox) {
addButton();
} else {
setTimeout(waitForShoutbox, 500);
}
}
waitForShoutbox();
})();
It should look like this in the end:
 

452,496

328,880

328,888

Top