Glar.io hack chat

Glar.io online chat

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

Advertisement:

// ==UserScript==
// @name         Glar.io hack chat
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Glar.io online chat
// @author       Dekudo#1414
// @match        *://glar.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=glar.io
// @grant        none
// ==/UserScript==

+~(async () => {
    const socket = new WebSocket("wss://Glario-chat.codedayer78.repl.co");
    const isChat = () => document.activeElement.tagName === "INPUT";

    let nickname;

    const inter = setInterval(() => {
        if(document.getElementById("lobby-layout").style.display === "block") {
            nickname = document.getElementById("login-input").value;
            clearInterval(inter);
        }
    }, 100)

    const start = () => new Promise(resolve => {
        document.getElementById("login-button").addEventListener("click", () => {
            console.log("started")
            return resolve();
        })
    })

    await start();
    let message = new Array();
    let msg;

    window.addEventListener("keyup", () => {
        if(!isChat()) return;

        const chat = document.activeElement.value;

        message.push(chat);
    })

    window.addEventListener("keyup", event => {
        if(event.code === "Enter" && message[1]) {
            msg = message[message.length - 1];

            if(!msg.startsWith("/g ")) return;

            msg = msg.substring(3, Infinity);

            if(!msg) return new Error("Error! You must enter message");

            socket.send(`[Dekudo chat] \< ${nickname} \>  : ${msg}`);

            message = new Array();
        }
    })

    const div = `
    <div class="chat-container"></div>

    <style>
        .chat-container {
            margin: 0;
            top: 5%;
            left: 50%;
            margin-right: -50%;
            transform: translate(-50%, -50%);
            position: absolute;
            justify-content: center;
            color: #fff;
            font-size: 18px;
        }

        .chat-br {
            margin-top: 0.5px;
        }

        .mess {
          font-family: "Fira Sans", sans-serif;
          user-select: none;
        }
    </style>
    `

    document.body.insertAdjacentHTML("beforeend", div)

    socket.onmessage = msg => {
        const id = Math.floor(Math.random() * 999999);

        document.querySelector(".chat-container").innerHTML += `
           <center id="cnt"> <span class="mess"> <strong id="d_${id}"> </strong> </span> </center> <br class="chat-br">
        `

       document.getElementById(`d_${id}`).insertAdjacentText("beforeend", msg.data);
    }

	setInterval(() => {
		document.querySelector(".chat-container").innerHTML = ``;
	}, 10000);

    setInterval(async () => {
        const mess = document.querySelector(".mess");

        let opacity = 9;

        setInterval(() => {
            opacity--;

            if(!mess) return;

            if(opacity < 0) {
                mess.remove();
                return;
            }

            mess.style.opacity = `.${opacity}`
        }, 100);
    }, 5000)

    setInterval(() => {
        message = new Array();
    }, 7000)
})();