Greasy Fork

来自缓存

Greasy Fork is available in English.

Gartic.io Listen to WebSocket in Your Room

With this script, when you enter a room, you listen to the websocket. While in the game, you can send data to the game from the console with wsObj.send(). wsObj.id gives your current room id. wsObj.lengthID gives your id consisting of letters.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Gartic.io Listen to WebSocket in Your Room
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  With this script, when you enter a room, you listen to the websocket. While in the game, you can send data to the game from the console with wsObj.send(). wsObj.id gives your current room id. wsObj.lengthID gives your id consisting of letters.
// @author       Mré
// @license      MIT
// @match        *://gartic.io/*
// @icon         https://see.fontimg.com/api/rf5/rvaw8/OTRjZDMyNDZkNzRiNDg3Njk3N2I3NzlmODRmOTY1ZTQudHRm/TXLDqSA/hidden.png?r=fs&h=490&w=1000&fg=B31008&bg=DEDEDE&tb=1&s=490
// @grant none
// ==/UserScript==

let originalSend = WebSocket.prototype.send,setTrue=false;
window.wsObj={}

WebSocket.prototype.send=function(data){
console.log("Gönderilen Veri: "+data)
originalSend.apply(this, arguments)
if(Object.keys(window.wsObj).length==0){window.wsObj=this;window.eventAdd()}
};

window.eventAdd=()=>{
if(!setTrue){
setTrue=1
window.wsObj.addEventListener("message",(msg)=>{
try{
let data=JSON.parse(msg.data.slice(2))
console.log(data)
if(data[0]==5){
window.wsObj.lengthID=data[1]
window.wsObj.id=data[2]
window.wsObj.roomCode=data[3]
}
}catch(err){}
})
}
}