Torn Dump Instant Search

Quickly spam searching the dump

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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         Torn Dump Instant Search
// @match        https://www.torn.com/dump.php*
// @grant        none
// @description  Quickly spam searching the dump
// @author       Manuel [3747263]
// @license      MIT
// @version 0.0.1.20251214114927
// @namespace https://greasyfork.org/users/1480021
// ==/UserScript==

(function () {
    'use strict';

    const RFCV = window.rfcv;

    function instantSearch() {
        fetch(`/dump.php?step=search&rfcv=${RFCV}`, {
            method: "POST",
            credentials: "include",
            headers: {
                "X-Requested-With": "XMLHttpRequest"
            }
        }).then(r => r.json()).then(() => {
            // instantly restore UI so you can click again
            unlockSearchUI();
        });
    }

    function unlockSearchUI() {
        // remove animation / glow
        document.querySelectorAll(
            '.timeout_glow, .search-progress-wrap, .searcher'
        ).forEach(e => {
            e.classList.remove('in-progress', 'item-found', 'glow');
            e.style.display = 'none';
        });

        // re-enable SEARCH button
        const searchWrap = document.querySelector('.btn-wrap.search');
        if (searchWrap) {
            searchWrap.style.display = 'block';
            searchWrap.classList.remove('disabled');
        }
    }

    document.addEventListener('click', e => {
        const btn = e.target.closest('a[href*="step=search"]');
        if (!btn) return;

        e.preventDefault();
        e.stopImmediatePropagation();

        instantSearch();
    }, true);
})();