Options for arithmetic.zetamac.com

Set options for the game arithmetic.zetamac.com

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Options for arithmetic.zetamac.com
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Set options for the game arithmetic.zetamac.com
// @author       Anakojm
// @match        http*://arithmetic.zetamac.com/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=zetamac.com
// @grant        none
// @license      GPL
// ==/UserScript==

(function() {
    'use strict';
//--------------------------------------------------------------------
// These are the defaults, modify them to your liking
    let addition=true
    let additionLeftMin=2
    let additionLeftMax=100
    let additionRightMin=2
    let additionRightMax=100
    let substraction=true
    let multiplication=true
    let multiplicationLeftMin=2
    let multiplicationLeftMax=12
    let multiplicationRightMin=2
    let multiplicationRightMax=100
    let division=true
    let time=120
//--------------------------------------------------------------------

    document.getElementsByName("add").item(0).checked=addition;
    document.getElementById("add_left_min").value=additionLeftMin;
    document.getElementById("add_left_max").value=additionLeftMax;
    document.getElementById("add_right_min").value=additionRightMin;
    document.getElementById("add_right_max").value=additionRightMax;

    document.getElementsByName("sub").item(0).checked=substraction;

    document.getElementsByName("mul").item(0).checked=multiplication;
    document.getElementById("mul_left_min").value=multiplicationLeftMin;
    document.getElementById("mul_left_max").value=multiplicationLeftMax;
    document.getElementById("mul_right_min").value=multiplicationRightMin;
    document.getElementById("mul_right_max").value=multiplicationRightMax;

    document.getElementsByName("div").item(0).checked=division;
    // Compatibility with https://greasyfork.org/en/scripts/447512-custom-time-for-arithmetic-zetamac-com
    if (document.querySelector("div#welcome form.game-options p input")){
    document.getElementsByName("duration").item(0).value=time;
    } else{
    document.getElementsByTagName("option").item(0).remove();
    document.getElementsByTagName("option").item(0).remove();
    document.getElementsByTagName("option").item(1).remove();
    document.getElementsByTagName("option").item(1).remove();
    document.getElementsByTagName("option").item(0).value=time;
    document.getElementsByTagName("option").item(0).text=time+" seconds";
    }
})();