您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
chat scroller for gats.io
当前为
- // ==UserScript==
- // @name Gats.io - Chat scroller
- // @namespace http://tampermonkey.net/
- // @version 2.0
- // @description chat scroller for gats.io
- // @author nitrogem35
- // @match https://gats.io
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- var chatLoop;
- var maxLength;
- var scrollText = ''
- var scrollSpeed = 80
- function startChatLoop() {
- let s = scrollText
- chatLoop = setInterval(function(){
- (s.length < 30) ? (maxLength = s.length) : (maxLength = 30)
- s = s.substr(1) + s.substr(0, 1);
- RF.list[0].socket.send(`c,${s.substring(Math.round(Math.random()),maxLength)}`)
- }, scrollSpeed)
- }
- document.getElementById("chatbox").setAttribute("maxlength", 120)
- var div = document.createElement("div"); document.body.appendChild(div);
- function createHTML() {
- let html = `
- <style>
- .main {
- pointer-events: none; position: fixed; z-index:999; top: 180px; left: 10px;
- font-family: 'arial';
- color: black;
- font-size: 20px;
- }
- </style>
- <div class="main" id="scrollerGUI">
- <br>nitrogem35's chat scroller</br>
- <br>Text to Scroll: ${scrollText}</br>
- <br>Save text (from chatbox) [\\]</br>
- <br>Start/Stop Scroll: [']</br>
- <br>Scroll Speed (Higher=slower): ${scrollSpeed} [,] (+) / [.] (-) </br>
- <br>Hide overlay: [;]</br>
- </div>`
- div.innerHTML = html;
- }
- createHTML()
- document.addEventListener('keydown', function(key) {
- if(key.keyCode == 222) {
- if(chatLoop) {
- clearInterval(chatLoop);
- chatLoop = undefined
- }
- else {
- startChatLoop();
- }
- };
- if(key.keyCode == 220) {
- scrollText = document.getElementById("chatbox").value
- scrollText += ' '
- createHTML()
- }
- if(key.keyCode == 190) {
- (scrollSpeed > 0) ? (scrollSpeed -= 5) : (null)
- createHTML()
- restartChatLoop()
- }
- if(key.keyCode == 188) {
- scrollSpeed += 5
- createHTML()
- restartChatLoop()
- }
- if(key.keyCode == 186) {
- if(div.innerHTML != '') div.innerHTML = ''
- else createHTML()
- }
- })
- function restartChatLoop() {
- if(chatLoop) {
- clearInterval(chatLoop);
- chatLoop = undefined
- }
- startChatLoop()
- }
- })();