Auto Skip Ads and Auto Download on DropGalaxy
当前为
// ==UserScript==
// @name DropGalaxy Auto Skip
// @namespace http://tampermonkey.net/
// @version 1.2
// @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);
})();