moomoo.io chat shortcuts

// ==UserScript== // @name moomoo.io chat shortcuts // @namespace http://bzzzzdzzzz.blogspot.com/ // @version 0.1 // @description read name // @author BZZZZ // @match *://moomoo.io/* // @match *://sandbox.moomoo.io/* // @grant none // ==/UserScript== var chatShortcuts = { // add or remove stuff here "KeyH": "Hello!", "KeyB": "Bye!", "KeyG": "Goodbye, cruel world." }; var sockSend = WebSocket.prototype.send, sock; var blobOptions = {"type": "application/octet-stream"}; function sendChat(msg) { msg = new Blob([msg], blobOptions); var size = msg.size; if ((size > 30) || (size < 1)) throw new Error("invalid message size"); sockSend.call(sock, new Blob([new Uint8Array([146, 162, 99, 104, 145, 160 + size]), msg], blobOptions)); } function isHidden(element) { return window.getComputedStyle(element, null).getPropertyValue("display") === "none"; } function socketFoundCallBack() { document.addEventListener("keydown", function (evt) { var msg = chatShortcuts[evt.code]; if ((typeof msg !== "undefined") && isHidden(chatHolder) && !isHidden(gameUI) && isHidden(allianceMenu)) sendChat(msg); }, false); } WebSocket.prototype.send = function () { WebSocket.prototype.send = sockSend; sock = this; socketFoundCallBack(); return sockSend.apply(this, arguments); };

No comments:

Post a Comment