Agar.io Mouse Controls

Left-click = Split, Right-click = Feed.

Version vom 17.05.2017. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Agar.io Mouse Controls
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Left-click = Split, Right-click = Feed.
// @author       Tom Burris
// @icon         http://bit.ly/2oT4wRk
// @match        http://agar.io/*
// @grant        none
// @noframes
// ==/UserScript==

(function() {
    'use strict';

    var speed = 50;
    var ejectDown = false;
    var canvas = document.getElementById("canvas");
    canvas.addEventListener("mousedown", function(event) {
        switch(event.which) {
            case 1:
                window.core.split();
                break;
            case 2:
                for(var n = 0; n < 4; n++) {
                    setTimeout(window.core.split, n * speed);
                }
                break;
            case 3:
                ejectDown = true;
                eject();
                break;
        }
    });
    window.addEventListener("mouseup", function(event) {
        if (event.which == 3) {
            ejectDown = false;
        }
    });
    canvas.addEventListener("mousewheel", function(event) {
        canvas.dispatchEvent(new MouseEvent('mousemove', {'clientX': window.innerWidth/2, 'clientY': window.innerHeight/2}));
    });
    canvas.addEventListener("contextmenu", prevent);
    canvas.addEventListener("drag", prevent);
    function eject() {
        if (ejectDown) {
            window.core.eject();
            setTimeout(eject, speed);
        }
    }
    function prevent(event) {
        event.preventDefault();
    }
})();