Press + to go to next or - to go to previous report and auto press index at the same time.
// ==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!");
}
})
})();