Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



 199

[SCRIPT] Add a button to the shoutbox

by Alex - 18 August, 2024 - 03:53 PM
This post is by a banned member (Alex) - Unhide
Alex  
Trial Moderator
2.233
Posts
891
Threads
Staff Team
5 Years of service
#1
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 keek 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:

[Image: cRHwYpB.png]
[Image: RTiMsnY.gif]
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.
This post is by a banned member (retrohaxxx) - Unhide
2.427
Posts
831
Threads
#2
HQ BUTTON SIR   [Image: pepeokay.png]
[Image: uWztodn.gif]


▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬♆▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
MIDDLE SPOT FOR SALE 

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬♆▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬




[Image: AptjMoE.gif]
BOTTOM AD BY @NOLEHR [ 03/10/24]
This post is by a banned member (Gaunter) - Unhide
This post is by a banned member (Alex) - Unhide
Alex  
Trial Moderator
2.233
Posts
891
Threads
Staff Team
5 Years of service
#4
(18 August, 2024 - 03:56 PM)Gaunter Wrote: Show More
pretty cool and good looking button
Next add a user autocomplete mention after typing @

On it : [Image: hackerman_xmas.gif]
[Image: RTiMsnY.gif]
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.

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)