Greasy Fork

Greasy Fork is available in English.

Auto Goku.to Sign

Automatically clicks the Sign In button for goku.to after 10 seconds, and fills in the email and password fields if provided by the user.

当前为 2023-06-29 提交的版本,查看 最新版本

// ==UserScript==
// @name       Auto Goku.to Sign
// @namespace  http://tampermonkey.net/
// @version    3.5
// @ author    longkidkoolstar
// @description  Automatically clicks the Sign In button for goku.to after 10 seconds, and fills in the email and password fields if provided by the user.
// @match       https://goku.sx/*
// @grant      none
// @license    GPL-3.0
// @icon        https://cdn.dribbble.com/users/289074/screenshots/1614713/sans_titre_-_2.png
// ==/UserScript==

(function() {
    'use strict';

    const email = localStorage.getItem('goku.to.email');
    const password = localStorage.getItem('goku.to.password');

    window.addEventListener('load', function() {
        const emailInput = document.querySelector('input[name="email"]');
        const passwordInput = document.querySelector('input[name="password"]');

        if (emailInput && passwordInput) {
            if (email && password) {
                emailInput.value = email;
                passwordInput.value = password;
            } else {
                const newEmail = prompt('Enter your email for Goku.to:', '');
                const newPassword = prompt('Enter your password for Goku.to:', '');
                if (newEmail && newPassword) {
                    localStorage.setItem('goku.to.email', newEmail);
                    localStorage.setItem('goku.to.password', newPassword);
                    emailInput.value = newEmail;
                    passwordInput.value = newPassword;
                }
            }
        }

        const button = document.querySelector('.account-button .btn.btn-blank');
        if (button) {
            button.click();
        }
    });
})();

(function() {
    'use strict';

    if (window.location.href.startsWith('https://goku.sx/login')) {
        let secondsToWait = null;
        const storedSeconds = localStorage.getItem('goku.to.autosign.seconds');
        if (storedSeconds !== null) {
            secondsToWait = parseInt(storedSeconds, 10);
        }
        if (!secondsToWait) {
            const input = prompt('Enter the number of seconds to wait before clicking the "Sign In" button. Default is 10 seconds.', '10');
            if (!input) return;
            secondsToWait = parseInt(input, 10);
            if (isNaN(secondsToWait)) {
                secondsToWait = 10;
            }
            localStorage.setItem('goku.to.autosign.seconds', secondsToWait.toString());
        }
        setTimeout(function() {
            const button = document.querySelector('.btn.btn-block.btn-primary.position-relative');
            if (button) {
                button.click();
            }
        }, secondsToWait * 1000);
    }
})();