Nama Script Kamu

Deskripsi singkat script

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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();
    });
})();