Auto Retry for lucida.to

Automatically press the retry button when something goes wrong. Mostly meant to fix error 429 but also works for other errors.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Auto Retry for lucida.to
// @author       cracktorio
// @namespace    https://cracktorio.net/
// @version      1.1
// @description  Automatically press the retry button when something goes wrong. Mostly meant to fix error 429 but also works for other errors.
// @match        *://lucida.to/*
// @match        *://lucida.su/*
// @grant        none
// @license      GNU GPLv3
// ==/UserScript==
 
(function() {
    'use strict';
 
    // Define the selector for the div that changes display
    const displayDivSelector = '#zip-error'; // Replace with the actual class of the div
    let displayDiv;
    let RetryButton;
    console.log("retry download script running");
 
    // Interval check function to detect display change
    setInterval(() => {
    displayDiv = document.querySelector(displayDivSelector);
    RetryButton = document.querySelector('button[data-action="retry"]');
 
        if (displayDiv && window.getComputedStyle(displayDiv).display !== 'none' && RetryButton) {
            console.log("Waiting 200ms to press retry button.");
            setTimeout(() => {
                RetryButton.click();
                console.log("Retry button clicked due to display change.");
            }, 200); // Wait 200ms before clicking
        }
    }, 2000); // Check every 2000 milliseconds
 
})();