// ==UserScript== // @name Gota Addons // @namespace https://greasyfork.org/en/scripts/404047-gotachat // @version 1.2 // @description Some random shit to add to the game lmao // @author Specy // @match *://gota.io/web* // @grant none // @downloadURL none // ==/UserScript== //screenshot with CTRL+ALT var canvas = document.getElementById("canvas") document.addEventListener("keydown", function KeyPress(e) { var evtobj = window.event? event : e if (evtobj.altKey && evtobj.shiftKey){ canvas.toBlob((blob) => { saveBlob(blob, `gotascreen.png`); }); } }) const saveBlob = (function() { const a = document.createElement('a'); document.body.appendChild(a); a.style.display = 'none'; return function saveData(blob, fileName) { const url = window.URL.createObjectURL(blob); a.href = url; a.download = fileName; a.click(); }; }()); //Last messages var chatTable = document.getElementById("chat-body-0"); var chatHistory = [] $('#chat-body-0').on("DOMSubtreeModified", function() { var nickname = document.getElementById("name-box").value var lastMessage = chatTable.rows[chatTable.rows.length - 1].innerText if(lastMessage.includes(":")) { lastMessage = lastMessage.split(":") if(lastMessage[0].includes(nickname)) { chatHistory.push(lastMessage[1]) } } var timesUpPressed = 0 document.onkeydown = function(evt) { var chatInput = document.getElementById("chat-input") evt = evt || window.event; if(evt.keyCode == 38 || evt.keyCode == 40) { if(evt.keyCode == 40) timesUpPressed-- if(evt.keyCode == 38) timesUpPressed++ if(timesUpPressed < chatHistory.length + 1 && timesUpPressed > 0) { console.log(timesUpPressed) chatInput.value = chatHistory[chatHistory.length - timesUpPressed] chatInput.focus() } else { timesUpPressed = 0 } } else { timesUpPressed = 0 } } })