warpcast follow helper

try to take over the world!

// ==UserScript==
// @name         warpcast follow helper
// @namespace    http://tampermonkey.net/
// @version      2024-05-30
// @description  try to take over the world!
// @author       You
// @match        https://warpcast.com/wlist/following
// @icon         https://www.google.com/s2/favicons?sz=64&domain=warpcast.com
// @grant        GM_registerMenuCommand
// @grant        GM_setValue
// @grant        GM_getValue
// @run-at       document-end
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    GM_registerMenuCommand("Settings", function() {
        var waitTime = prompt("Enter interval time (seconds), default is 1s:", GM_getValue("waitTime", 1));
        if (waitTime !== null && !isNaN(waitTime)) {
            GM_setValue("waitTime", waitTime);
        }

        var followCount = prompt("Enter the number of follows, default is 400:", GM_getValue("followCount", 400));
        if (followCount !== null && !isNaN(followCount)) {
            GM_setValue("followCount", followCount);
        }
    });

    GM_registerMenuCommand("Donate", function() {
        prompt("If you'd like to support us, please donate to the following Solana address:", '5418G9ro4YkrbgwdTEDsykjk6zLPLgATHkDvBXX3zAF6');
    });


    GM_registerMenuCommand("Stop", function() {
        clearInterval(HELPER);
        alert('Stoped')
    });

    alert('Please follow this guide to use:\n1. Open https://warpcast.com/wlist\n2. Click "Following"\n3. Running');



    var waitTime = GM_getValue("waitTime", 1)*1000;
    var follwCount = GM_getValue("follwCount", 400);


    var HELPER;
    setTimeout(clickFollowButtons, 5000);

    var currentCount = 0

    function clickFollowButtons() {
        var followButtons = document.getElementsByClassName("rounded-lg font-semibold disabled:opacity-50 bg-action text-light px-4 py-2 text-sm subtle-hover-z min-w-[92px] ml-2");

        var i = 0;
        HELPER = setInterval(function() {
            if (i < followButtons.length) {
                var button = followButtons[i];
                if (button.innerText.trim() === "Follow") {
                    button.click();
                }
                i++;
                currentCount++
                console.log('Follow +',currentCount)
            }else{
                if(currentCount<follwCount){
                    clearInterval(HELPER);
                    window.scrollTo(0, document.body.scrollHeight);
                    setTimeout(clickFollowButtons, waitTime);
                }

            }
        }, waitTime);
    }

})();