REPORT NAVIGATOR

Press + to go to next or - to go to previous report and auto press index at the same time.

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

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

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         REPORT NAVIGATOR
// @version      1.0
// @description  Press + to go to next or - to go to previous report and auto press index at the same time.
// @author       AV
// @include      https://*.grepolis.com/game/*
// @grant        none
// @namespace    none
// @license      MIT
// @icon         https://pluspng.com/img-png/next-button-png-right-arrow-circular-button-338.jpg
// ==/UserScript==

(async function() {
    'use strict';

    document.addEventListener('keypress', (event) => {
        const runIndex = () => {
            const indexBTN = document.getElementById('gd_index_rep_txt');
            if (!indexBTN) return;
            if (indexBTN.textContent === 'Index +') indexBTN.click();
        }
        try{
            if (event.key === '+') {
                // var next = document.getElementsByClassName('btn_next');
                if (document.getElementsByClassName('next_button')) {
                    document.getElementsByClassName('next_button')[0].click();
                    runIndex();
                }
            } else if (event.key === '_') {
                // var prev = document.getElementsByClassName('btn_prev');
                if (document.getElementsByClassName('previous_button')) {
                    document.getElementsByClassName('previous_button')[0].click();
                    runIndex();
                }
            }
        } catch (err) {
            console.log("Buttons Not Found!");
        }
        
    })
})();