chat scroller for gats.io with continuous scrolling
< 脚本Gats.io - Chat scroller的反馈
hi the script didnt work so i fixed it for myself:// ==UserScript==// @name Gats.io - Chat scroller// @namespace http://tampermonkey.net/// @version 3.3// @description chat scroller for gats.io with continuous scrolling// @author nitrogem35// @match https://gats.io/// @grant none// @downloadURL https://update.gf.qytechs.cn/scripts/427578/Gatsio%20-%20Chat%20scroller.user.js// @updateURL https://update.gf.qytechs.cn/scripts/427578/Gatsio%20-%20Chat%20scroller.meta.js// ==/UserScript==(function() { 'use strict'; let chatLoop; let maxLength; let scrollText = ''; let scrollSpeed = 200; let currentIndex = 0; function startChatLoop() { chatLoop = true; loopFunc(); } function loopFunc() { if (!chatLoop) return; let s = scrollText; let e = currentIndex % 12 === 0 ? 1 : 0; if (s.length < 28) { maxLength = s.length; } else { maxLength = 28; } let displayText = s.substring(currentIndex, currentIndex + maxLength); if (displayText.length < maxLength) { displayText += s.substring(0, maxLength - displayText.length); } let z = displayText.split(''); let numRandom = Math.round(Math.random() * 2); for (let j = 0; j < numRandom; j++) { z.push(" "); } z = z.join(""); // Encode commas (,) as tilde (~) because gats client does that z = z.replaceAll(",", "~"); // Properly send the text with one parameter Connection.list[0].socket.send(z); currentIndex = (currentIndex + 1) % s.length; setTimeout(loopFunc, scrollSpeed); } document.getElementById("chatbox").setAttribute("maxlength", 1000); var div = document.createElement("div"); document.body.appendChild(div); function createHTML() { let html = `
`; div.innerHTML = html; } createHTML(); document.addEventListener('keydown', function(key) { if (key.keyCode == 222) { chatLoop = !chatLoop; if (chatLoop) startChatLoop(); } if (key.keyCode == 220) { scrollText = document.getElementById("chatbox").value + ' '; createHTML(); } if (key.keyCode == 190) { scrollSpeed += 5; createHTML(); } if (key.keyCode == 188) { scrollSpeed = Math.max(0, scrollSpeed - 5); createHTML(); } if (key.keyCode == 186) { div.innerHTML = div.innerHTML ? '' : createHTML(); } });})();
登录(不可用)以发表回复。
土豆服务器,请按需使用
镜像地址随时可能被墙,建议加群获取最新地址
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址
hi the script didnt work so i fixed it for myself:
// ==UserScript==
// @name Gats.io - Chat scroller
// @namespace http://tampermonkey.net/
// @version 3.3
// @description chat scroller for gats.io with continuous scrolling
// @author nitrogem35
// @match https://gats.io/
// @grant none
// @downloadURL https://update.gf.qytechs.cn/scripts/427578/Gatsio%20-%20Chat%20scroller.user.js
// @updateURL https://update.gf.qytechs.cn/scripts/427578/Gatsio%20-%20Chat%20scroller.meta.js
// ==/UserScript==
(function() {
'use strict';
let chatLoop;
let maxLength;
let scrollText = '';
let scrollSpeed = 200;
let currentIndex = 0;
function startChatLoop() {
chatLoop = true;
loopFunc();
}
function loopFunc() {
if (!chatLoop) return;
let s = scrollText;
let e = currentIndex % 12 === 0 ? 1 : 0;
if (s.length < 28) {
maxLength = s.length;
} else {
maxLength = 28;
}
let displayText = s.substring(currentIndex, currentIndex + maxLength);
if (displayText.length < maxLength) {
displayText += s.substring(0, maxLength - displayText.length);
}
let z = displayText.split('');
let numRandom = Math.round(Math.random() * 2);
for (let j = 0; j < numRandom; j++) {
z.push(" ");
}
z = z.join("");
// Encode commas (,) as tilde (~) because gats client does that
z = z.replaceAll(",", "~");
// Properly send the text with one parameter
Connection.list[0].socket.send(z);
currentIndex = (currentIndex + 1) % s.length;
setTimeout(loopFunc, scrollSpeed);
}
document.getElementById("chatbox").setAttribute("maxlength", 1000);
var div = document.createElement("div");
document.body.appendChild(div);
function createHTML() {
let html = `
nitrogem35's chat scroller (Improved)
Text to Scroll: ${scrollText}
Save text (from chatbox) [\\]
Start/Stop Scroll: [']
Scroll Speed (Higher=slower): ${scrollSpeed}ms [.] (+) / [,] (-)
Hide overlay: [;]
`;
div.innerHTML = html;
}
createHTML();
document.addEventListener('keydown', function(key) {
if (key.keyCode == 222) {
chatLoop = !chatLoop;
if (chatLoop) startChatLoop();
}
if (key.keyCode == 220) {
scrollText = document.getElementById("chatbox").value + ' ';
createHTML();
}
if (key.keyCode == 190) {
scrollSpeed += 5;
createHTML();
}
if (key.keyCode == 188) {
scrollSpeed = Math.max(0, scrollSpeed - 5);
createHTML();
}
if (key.keyCode == 186) {
div.innerHTML = div.innerHTML ? '' : createHTML();
}
});
})();