XBIZ Awards Voting Automation

Automate voting on XBIZ Awards pages.

// ==UserScript==
// @name         XBIZ Awards Voting Automation
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Automate voting on XBIZ Awards pages.
// @author       Strad
// @match        https://creatorawards.xbiz.com/voting/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to perform actions on the voting page
    function handleVotingPage() {
        // Check if it's the correct voting page
        if (window.location.href.includes("XCA24-12.php")) {
            setTimeout(() => {
                // Select the first available radio input inside the finalist div
                const radioInput = document.querySelector('.finalist input[type="radio"]');
                if (radioInput) {
                    radioInput.click(); // Click the radio button
                }

                // Click the submit button
                const submitBtn = document.getElementById('btn-submit');
                if (submitBtn) {
                    submitBtn.click();
                }
            }, 1000); // Adjust time as needed for page to load fully
        }
    }


    // Function to handle the success page
    function handleSuccessPage() {
        if (window.location.href.includes("success.php")) {
            setTimeout(() => {
                // Redirect back to the original voting page
                window.location.href = "https://creatorawards.xbiz.com/voting/XCA24-12.php";
            }, 2000); // Wait for a couple of seconds before redirecting
        }
    }

    // Call the appropriate function based on the current page
    handleVotingPage();
    handleSuccessPage();
})();