Solving maths is fun

Solves fun math

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Solving maths is fun
// @description  Solves fun math
// @author       Ko
// @version      1.2
// @include      *.koalabeast.com:*
// @include      *.jukejuice.com:*
// @include      *.newcompte.fr:*
// @include      *.koalabeast.com/game
// @include      *.jukejuice.com/game
// @include      *.newcompte.fr/game
// @icon         https://raw.githubusercontent.com/wilcooo/TagPro-ScriptResources/master/maths.png
// @supportURL   https://www.reddit.com/message/compose/?to=Wilcooo
// @license      MIT
// @namespace https://greatest.deepsurf.us/users/152992
// ==/UserScript==


tagpro.ready(function() {

    var names = [];

    tagpro.socket.on('p', function(p) {

        for (var pu of (p.u || p)) {

            if (pu.name != names[pu.id]) {
                names[pu.id] = pu.name;

                if (pu.name && isNaN(pu.name) && pu.name.match(/^[ \d×÷=/*+-]+$/)) {
                    try {
                        var answer = eval(pu.name.replace('×','*').replace('÷','/').replace('=',''));
                        setTimeout(tagpro.socket.emit,
                                   500 + Math.random()*1000,
                                   'chat', {message:String(answer)});
                    } catch(e){}
                }
            }
        }
    });
});