Nama Script Kamu

Deskripsi singkat script

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

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