NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Auto Delete Reports and Redirect
// @namespace https://*.plemiona.pl/
// @description Skrypt przenosi na stronę z raportami i usuwa wszystkie raporty po naciśnięciu skrótu Shift + 1, 2, 3 i 4 bez blokowania innych skrótów.
// @homepage https://plemiona.pl/
// @version 2.0
// @license MIT
// @match https://*.plemiona.pl/game.php*
// @grant none
// ==/UserScript==
(function() {
// Funkcja do zaznaczania raportów i ich usunięcia
function deleteReports() {
var selectAllCheckbox = document.getElementById('select_all_top');
if (selectAllCheckbox) {
selectAllCheckbox.click(); // Zaznacz wszystkie raporty
} else {
console.error("Checkbox 'Zaznacz wszystko' nie został znaleziony.");
return;
}
var deleteButton = document.querySelector('input[name="del"]');
if (deleteButton) {
deleteButton.click(); // Kliknij przycisk "Skasuj"
} else {
console.error("Przycisk 'Skasuj' nie został znaleziony.");
}
}
// Funkcja sprawdzająca, czy jesteśmy na odpowiedniej stronie raportów
function checkAndDeleteReports(mode) {
const currentUrl = window.location.href;
if (currentUrl.includes(`screen=report&mode=${mode}`)) {
deleteReports();
}
}
// Funkcja obsługująca przekierowanie na odpowiednią stronę raportów
function handleRedirect(mode) {
const targetUrl = `https://${window.location.host}/game.php?village=${window.game_data.village.id}&screen=report&mode=${mode}`;
window.location.href = targetUrl;
}
// Nasłuchiwanie na zdarzenia klawiatury
document.addEventListener('keydown', function(event) {
if (event.shiftKey && (event.key === '1' || event.code === 'Digit1' || event.code === 'Numpad1')) { // Shift + 1
event.preventDefault();
handleRedirect('support');
}
if (event.shiftKey && (event.key === '2' || event.code === 'Digit2' || event.code === 'Numpad2')) { // Shift + 2
event.preventDefault();
handleRedirect('trade');
}
if (event.shiftKey && (event.key === '3' || event.code === 'Digit3' || event.code === 'Numpad3')) { // Shift + 3
event.preventDefault();
handleRedirect('event');
}
if (event.shiftKey && (event.key === '4' || event.code === 'Digit4' || event.code === 'Numpad4')) { // Shift + 4
event.preventDefault();
handleRedirect('other');
}
});
// Sprawdzaj stronę za każdym razem, gdy się na nią przechodzi
const modes = ['trade', 'event', 'other', 'support'];
modes.forEach((mode) => checkAndDeleteReports(mode));
})();