Gangsters Whores Auto Input

Automatycznie ustawia wartości inputów na stronach g2.gangsters.pl (whores) według mapy ustawień

目前為 2025-10-02 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Gangsters Whores Auto Input
// @namespace    https://greasyfork.org/users/mleko95
// @version      1.0
// @description  Automatycznie ustawia wartości inputów na stronach g2.gangsters.pl (whores) według mapy ustawień
// @author       mleko95
// @match        *://g2.gangsters.pl/?module=whores&page=*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=gangsters.pl
// @grant        none
// @license MIT
// ==/UserScript==


(function() {
    'use strict';

    // Funkcja do pobrania numeru strony z URL
    function getPageNumber() {
        const params = new URLSearchParams(window.location.search);
        return parseInt(params.get("page"), 10) || 1;
    }

    const page = getPageNumber();

    /**
     * MAPA STRONA → {divNumer: "wartość"}
     * divNumer to ta liczba z fullxpath (div/div[3], div/div[4] itd.)
     * Przykład:
     *   page=1 → div[3] = "10", div[4] = "20"
     */
    const valuesForPages = {
        1: { 3: "10", 4: "20", 5: "30" },   // dla strony 1
        2: { 3: "40", 4: "50" },            // dla strony 2
        3: { 5: "60" }                      // dla strony 3
    };

    const values = valuesForPages[page];
    if (!values) {
        console.log("Brak zdefiniowanych wartości dla strony", page);
        return;
    }

    // Ustawiamy wartości w inputach
    Object.entries(values).forEach(([divNum, val]) => {
        const xpath = `/html/body/div[1]/div[3]/div[2]/div[2]/div/div[${divNum}]/table/tbody/tr/td[3]/form[1]/div/input`;
        const el = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

        if (el) {
            el.value = val;
            console.log(`✅ Ustawiono div[${divNum}] = ${val}`);
        } else {
            console.warn(`⚠️ Nie znaleziono inputa dla div[${divNum}] na stronie ${page}`);
        }
    });

})();