REPORT NAVIGATOR

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==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!");
        }
        
    })
})();