Untitled

 avatar
unknown
plain_text
a year ago
1.7 kB
6
Indexable
// ==UserScript==
// @name         Gartic.io Button Script
// @namespace    http://tampermonkey.net/
// @version      2024-01-03
// @description  Add custom buttons to Gartic.io
// @author       You
// @match        *://*/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=gartic.io
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...

    const answerButton = document.createElement("button");
    answerButton.className = "btYellowBig ic-answer";
    answerButton.style.width = "30px";
    answerButton.style.height = "30px";
    answerButton.style.zIndex = "99";

    answerButton.addEventListener("mousedown", () => {
        sendMessage('input[name=answer]', document.querySelector("#answer input").value, rand());
    });

    const chatButton = document.createElement("button");
    chatButton.className = "btYellowBig ic-chat";
    chatButton.style.width = "30px";
    chatButton.style.height = "30px";
    chatButton.style.zIndex = "99";

    chatButton.addEventListener("mousedown", () => {
        sendMessage('input[name=chat]', document.querySelector("#chat input").value, rand());
    });

    // Add buttons to the document
    document.querySelector("#someContainerElement").appendChild(answerButton);
    document.querySelector("#someContainerElement").appendChild(chatButton);

    // Helper function to send messages
    function sendMessage(selector, value, randomValue) {
        // Implement your logic here to send messages
        // You can use the provided parameters (selector, value, randomValue)
    }

    function rand() {
        // Implement your logic to generate a random value
        // Return the generated random value
    }
})();
Editor is loading...
Leave a Comment