DropGalaxy Auto Skip

Auto skip ads and auto download on DropGalaxy

目前為 2024-04-08 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         DropGalaxy Auto Skip
// @namespace    http://tampermonkey.net/
// @version      1.3.1
// @description  Auto skip ads and auto download on DropGalaxy
// @author       kleptomaniac14
// @match        https://dropgalaxy.com/*
// @match        https://dropgalaxy.co/*
// @match        https://financemonk.net/*
// @icon         https://www.google.com/s2/favicons?domain=dropgalaxy.com
// @grant        none
// @license      GNU GPLv2
// ==/UserScript==

// Setting esversion to 11 to use optional chaining.
/* jshint esversion: 11 */

(function () {
    "use strict";

    // Constants
    const MAX_IDENTIFICATION_RETRIES = 100;

    // Global Variables
    let identificationRetries = 0;

    // Utils
    const log = (message) => console.log(`[DropGalaxy Auto Skip] ${message}`);

    // One Time Setup
    log("DropGalaxy Script Loaded");

    // Page Handlers
    const handlePage1 = () => {
        log("Handling Page 1");

        // Click on Download Button
        const downloadBtn = document.getElementById("method_free");
        downloadBtn.click();
    };

    const handlePage3 = () => {
        log("Handling Page 3");

        // Click on Download Button
        const downloadForm = document.getElementById("dllink");
        const url = downloadForm.action;

        window.location.assign(url);
    };

    const handlePage2 = () => {
        log("Handling Page 2");

        const falseDownloadBtn = document.getElementById("downloadbtn");
        const tokenStatus = document.getElementById("tokennstatus");

        // Keep clicking until enabled
        const downloadIntervalId = setInterval(() => {
            if (
                tokenStatus.innerText === "ready!" &&
                falseDownloadBtn.disabled === false
            ) {
                log("Download Button Enabled, submitting form");
                // downloadBtn.click();
                document.getElementById("ff1").submit();
                clearInterval(downloadIntervalId);
            }
        }, 500);
    };

    const handlePage = (pageWatcherIntervalId) => {
        const page1Identifier = document.getElementById("method_free");
        const page2Identifier = document.getElementById("countdown");
        const page3Identifier = document.getElementById("url");

        const adblockPageIdentifier = document.querySelector(
            "body > div.container.pt-5.page.message > div > div > div"
        );
        const isAdblockPage =
            adblockPageIdentifier?.innerText === "\nAdblock Detected!";

        // If page is recognized, clear the interval to stop checking
        if (
            pageWatcherIntervalId &&
            (page1Identifier ||
                page2Identifier ||
                page3Identifier ||
                isAdblockPage)
        ) {
            log("Page Identified, stopping page watcher");
            clearInterval(pageWatcherIntervalId);
            // identificationRetries = 0;
            // no need to reset retries, as it will be reset on next page load
        }

        if (page1Identifier) {
            handlePage1();
        } else if (page2Identifier) {
            handlePage2();
        } else if (page3Identifier) {
            handlePage3();
        } else if (isAdblockPage) {
            // handleAdblockPage();
            // Not implemented
        } else if (MAX_IDENTIFICATION_RETRIES > identificationRetries) {
            log("Unknown Page or Waiting for identification");
            identificationRetries++;
        }
    };

    // Keep checking the page as soon as it loads
    let intervalId = setInterval(() => {
        handlePage(intervalId);
    }, 500);
})();