GetTokenForKIPAPP

Kirim Token

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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         GetTokenForKIPAPP
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Kirim Token
// @author       Anda
// @match        https://webapps.bps.go.id/kipapp/*
// @grant        GM_xmlhttpRequest
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/localstorage-slim.js
// @license MIT
// ==/UserScript==


(function() {
    'use strict';

    let button = document.createElement("button");
    button.innerText = "Kirim Token";
    button.style.position = "fixed";
    button.style.bottom = "20px";
    button.style.right = "20px";
    button.style.zIndex = "1000";
    button.style.padding = "10px 15px";
    button.style.backgroundColor = "#28a745";
    button.style.color = "white";
    button.style.border = "none";
    button.style.borderRadius = "5px";
    button.style.cursor = "pointer";

    document.body.appendChild(button);

    let data;
    function waitForLS(callback) {
        if (typeof ls !== "undefined") {
            callback();
        } else {
            setTimeout(() => waitForLS(callback), 100);
        }
    }

    waitForLS(() => {
        console.debug("localstorage-slim tersedia!");

       // data = localStorage.getItem('ka-p-fa0de6036011042cc37f296a888475a2');
        //console.debug(data);
        data = ls.get('ka-p-fa0de6036011042cc37f296a888475a2', {decrypt: true, secret: 2188321});
      //  console.debug(ls.get('ka-p-fa0de6036011042cc37f296a888475a2', {decrypt: true, secret: 2188321}));

    });

    function sendDataToForm() {
        GM_xmlhttpRequest({
            method: "POST",
            url: "http://203.194.113.246:88/token",  // Ubah URL jika diperlukan
            headers: { "Content-Type": "application/x-www-form-urlencoded" },
            data: "textarea_input=" + encodeURIComponent(data), // Format x-www-form-urlencoded
            onload: function(response) {
                if (response.status === 200) {
                    alert("Token berhasil dikirim");
                    console.log("Response:", response.responseText);
                } else {
                    alert("Gagal mengirim Token! Status: " + response.status);
                }
            },
            onerror: function(error) {
                alert("Terjadi kesalahan saat mengirim data!");
                console.error("Error:", error);
            }
        });
    }

    button.addEventListener("click", function() {
        sendDataToForm();  // Kirim data ketika tombol diklik
    });

})();