Automatically logs in and claims DGB, LTC and others on LinksFly faucet.
// ==UserScript==
// @name LinksFly Auto Claim DGB, LTC, FEY and others.
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Automatically logs in and claims DGB, LTC and others on LinksFly faucet.
// @author Rubystance
// @license MIT
// @match https://linksfly.link/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function tryClick(element) {
try {
element.click();
console.log("[AutoClaim] Clicked with element.click()");
} catch (e) {
console.warn("[AutoClaim] element.click() failed", e);
}
try {
HTMLElement.prototype.click.call(element);
console.log("[AutoClaim] Clicked with HTMLElement.prototype.click.call");
} catch (e) {
console.warn("[AutoClaim] HTMLElement.prototype.click.call failed", e);
}
['mouseover', 'mousedown', 'mouseup', 'click'].forEach(type => {
try {
const event = new MouseEvent(type, {
bubbles: true,
cancelable: true,
view: window
});
element.dispatchEvent(event);
console.log("[AutoClaim] Dispatched mouse event:", type);
} catch (e) {
console.warn("[AutoClaim] Dispatch event failed:", type, e);
}
});
}
async function waitForButton() {
return new Promise((resolve, reject) => {
const timeout = 30000;
const startTime = Date.now();
const interval = setInterval(() => {
const btn = document.querySelector('button.claim-button.step4');
const captchaOK = document.querySelector('.iconCaptcha.success');
const btnReady = btn && !btn.disabled && btn.offsetParent !== null;
const captchaReady = !!captchaOK;
if (btnReady || captchaReady) {
clearInterval(interval);
resolve(btn);
}
if (Date.now() - startTime > timeout) {
clearInterval(interval);
reject("Timeout waiting for button or captcha success.");
}
}, 5000);
});
}
async function main() {
try {
console.log("[AutoClaim] Waiting for button or captcha success...");
const btn = await waitForButton();
console.log("[AutoClaim] Condition met, waiting 5 seconds before clicking...");
await new Promise(r => setTimeout(r, 5000));
if (btn) {
tryClick(btn);
} else {
console.warn("[AutoClaim] Button not found at click time.");
}
} catch (e) {
console.error("[AutoClaim] Error:", e);
}
}
if (window.location.pathname === '/app/faucet' && window.location.search.includes('currency=DGB')) {
main();
}
})();