您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Let your cell spin, jump, shake, flip and wacky!
当前为
- // ==UserScript==
- // @name Agma Animation Script
- // @namespace http://tampermonkey.net/
- // @version 1.1
- // @description Let your cell spin, jump, shake, flip and wacky!
- // @author You
- // @match http://agma.io/
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- // Key to use to start
- // USe this tool to find out key codes - just press a button: https://unixpapa.com/js/testkey.html
- // 220 = Key below "ESC" ("`" on English QWERTY layout, "^" on German QWERTZ keyboard layout)
- var startKeyCode = 220;
- // True = Combine wacky with others animations,
- // False = Only other aninmations
- var combine = true;
- console.log('Agma Animation Script started! 🌸');
- /**
- * Returns a random number between min (inclusive) and max (exclusive)
- * Source: MDN
- */
- var getRandomArbitrary = function(min, max) {
- return Math.random() * (max - min) + min;
- }
- window.addEventListener('keydown', function(event)
- {
- if (event.keyCode == startKeyCode && ! event.shiftKey) {
- // The available commands
- var items = ['spin', 'flip', 'shake', 'jump'];
- // Choose randomly an item of the items array
- // Source: https://stackoverflow.com/questions/5915096/get-random-item-from-javascript-array
- var item = items[Math.floor(Math.random()*items.length)];
- if (combine) {
- item = 'wacky' + item;
- }
- // Add text into the chatbox and focus it
- $('#chtbox').val('/' + item).focus();
- sendKey(13);
- // Stop the event so that the pressed key won't be written into the chatbox!
- event.preventDefault();
- }
- });
- })();