OP 18 August, 2024 - 03:53 PM
Hello users, I just made this script for @retrohaxxx 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 but still wanted to share if you find it useful.
Just press add a new script in Tampermonkey and copy the code below, and save, it should be turned on automatically.
It should look like this in the end:
By @Resspy | Ends in 14/10
Disclaimer: I am not affiliated with any of the ads shown above. They're paid advertisements.
Always confirm with me on Forum PM's.
I do not sell, buy or exchange anything besides my signature. Be careful of impersonators & scammers.
It's not the best button, or the coolest but still wanted to share if you find it useful.
Just press add a new script in Tampermonkey and copy the code below, and save, it should be turned on automatically.
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 https://*.cracked.io/*
// @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:
By @Resspy | Ends in 14/10
Disclaimer: I am not affiliated with any of the ads shown above. They're paid advertisements.
Always confirm with me on Forum PM's.
I do not sell, buy or exchange anything besides my signature. Be careful of impersonators & scammers.