Nama Script Kamu

Deskripsi singkat script

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Nama Script Kamu
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Deskripsi singkat script
// @author       LuthfiDIKBUD
// @match        https://example.com/*
// @license      LuthfiDIKBUD-License
// ==/UserScript==

/*
  Lisensi: LuthfiDIKBUD-License
  - Anda diizinkan menggunakan script ini untuk keperluan pribadi.
  - Tidak diizinkan menyebarkan ulang tanpa izin tertulis dari pembuat.
  - Nama pembuat asli (LuthfiDIKBUD) harus tetap dicantumkan.
*/

(function () {
    'use strict';

    function delay(ms) {
        return new Promise(resolve => setTimeout(resolve, ms));
    }

    async function autoApprove() {
        console.log("🔍 Mulai pencarian baris status 'pengajuan' atau yang belum disetujui...");
        const rows = document.querySelectorAll("table.grocery-crud-table tbody tr");
        let count = 0;

        for (const row of rows) {
            const statusCell = row.querySelector("td:nth-child(13)");
            const actionDropdown = row.querySelector(".dropdown-menu");

            if (!statusCell || !actionDropdown) continue;

            const statusText = statusCell.innerText.trim().toLowerCase();

            // Gantilah ini kalau ternyata status yang ingin kamu proses punya nama lain
            if (statusText !== "disetujui") {
                const setujuLink = Array.from(actionDropdown.querySelectorAll("a"))
                    .find(a => a.innerText.trim().toLowerCase() === "setuju");

                if (setujuLink) {
                    console.log(`✅ Menyetujui baris: ${statusText}`);
                    setujuLink.click();
                    count++;
                    await delay(2000); // beri jeda agar server tidak overload
                }
            }
        }

        console.log(`🎉 Selesai! Total yang disetujui: ${count}`);
        return count;
    }

    async function continuousAutoApprove() {
        while (true) {
            const approvedCount = await autoApprove();
            if (approvedCount === 0) {
                console.log("Tidak ada baris yang perlu disetujui. Menunggu reload...");
                await delay(5000); // Tunggu 5 detik sebelum reload
            }
            window.location.reload();
        }
    }

    // Mulai proses secara otomatis saat halaman dimuat
    window.addEventListener("load", () => {
        console.log("🚀 Mulai proses setuju otomatis...");
        continuousAutoApprove();
    });
})();