Greasy Fork is available in English.

[New] Firefaucet.win

Dayli Bonus/Faucet Roll/Level Rewards/Dayli Tasks/Shortlinks/PTC

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
// ==UserScript==
// @name         [New] Firefaucet.win
// @namespace    https://greasyfork.org/users/1162863
// @version      1.1
// @description  Dayli Bonus/Faucet Roll/Level Rewards/Dayli Tasks/Shortlinks/PTC
// @author       Andrewblood
// @icon         https://coinfinity.top/favicon.ico
// @match        *://*.firefaucet.win/*
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        window.close
// @grant        window.focus
// @antifeature  referral-link     Referral-Link is in this Script integrated.
// @license      Copyright Andrewblood
// ==/UserScript==
/*
The script looks at first on Dashboard if it any from that aviable and clicks on that: Dayli Bonus/Faucet Roll/Level Rewards/Dayli Tasks/PTC/Shortlinks
Captcha Solver and Shortlink Maker for the PTC and Shortlinks on this site you can download from my Greasyfork profile: <a href="https://greasyfork.org/users/1162863" target="_blank">Andrewblood</a>.
Dayli Bonus/Faucet Roll: It choose the Captcha in this order if it is aviable: 1)Turnstile 2)ReCaptcha 3)HCaptcha
PTC: Download the Captcha Solver for full automation.
Shortlinks: On this page you can Unflag the sites and the script don't take the sites.
*/
(function() {
    'use strict';

    // CSS-Stil für das Overlay
    var overlayStyle = `
        #overlay {
            position: fixed !important;
            left: 10px !important; /* Abstand vom linken Rand */
            bottom: 10px !important; /* Abstand vom unteren Rand */
            width: 300px !important; /* Breite des Overlays */
            height: 300px !important; /* Höhe des Overlays */
            background-color: rgba(0, 0, 0, 0.5) !important; /* Halbtransparentes Schwarz */
            color: black !important; /* Schriftfarbe Schwarz */
            padding: 10px !important;
            z-index: 9999 !important; /* Stellen Sie sicher, dass das Overlay oben liegt */
            font-size: 16px !important; /* Schriftgröße 16px */
            display: flex;
            flex-direction: column; /* Überschrift und Inhalt untereinander */
        }

        #overlay h2 {
            font-size: 20px; /* Größe des h2-Titels */
            margin-bottom: 10px; /* Abstand nach unten */
            text-align: center; /* Überschrift zentriert */
        }

        .checkbox-container {
            display: flex;
            align-items: center; /* Vertikal zentriert */
            margin-left: 40px; /* Abstand vom linken Rand */
            margin-bottom: 5px; /* Abstand nach unten */
        }

        .checkbox-container input[type="checkbox"] {
            margin-right: 5px; /* Abstand zwischen Checkbox und Text */
        }
    `;

    // Füge den CSS-Stil hinzu
    GM_addStyle(overlayStyle);

    // Erstelle das Overlay-Element mit innerHTML
    var overlay = document.createElement('div');
    overlay.id = 'overlay';

    // Überschrift
    overlay.innerHTML = '<h2>Script by Andrewblood</h2>';

    var daylibonusCheckboxContainer = document.createElement('div');
    daylibonusCheckboxContainer.classList.add('checkbox-container');
    daylibonusCheckboxContainer.innerHTML = `
        <input type="checkbox" id="daylibonus-checkbox"> <!-- Kästchen zum Ankreuzen -->
        <label for="daylibonus-checkbox">Dayli Bonus</label> <!-- Text neben dem Kästchen -->
    `;
    overlay.appendChild(daylibonusCheckboxContainer);

    var faucetCheckboxContainer = document.createElement('div');
    faucetCheckboxContainer.classList.add('checkbox-container');
    faucetCheckboxContainer.innerHTML = `
        <input type="checkbox" id="faucet-checkbox"> <!-- Kästchen zum Ankreuzen -->
        <label for="faucet-checkbox">Faucet</label> <!-- Text neben dem Kästchen -->
    `;
    overlay.appendChild(faucetCheckboxContainer);

    var levelrewardCheckboxContainer = document.createElement('div');
    levelrewardCheckboxContainer.classList.add('checkbox-container');
    levelrewardCheckboxContainer.innerHTML = `
        <input type="checkbox" id="levelreward-checkbox"> <!-- Kästchen zum Ankreuzen -->
        <label for="levelreward-checkbox">Level Reward</label> <!-- Text neben dem Kästchen -->
    `;
    overlay.appendChild(levelrewardCheckboxContainer);

    var taskCheckboxContainer = document.createElement('div');
    taskCheckboxContainer.classList.add('checkbox-container');
    taskCheckboxContainer.innerHTML = `
        <input type="checkbox" id="task-checkbox"> <!-- Kästchen zum Ankreuzen -->
        <label for="task-checkbox">Dayli Tasks</label> <!-- Text neben dem Kästchen -->
    `;
    overlay.appendChild(taskCheckboxContainer);

    var ptcCheckboxContainer = document.createElement('div');
    ptcCheckboxContainer.classList.add('checkbox-container');
    ptcCheckboxContainer.innerHTML = `
        <input type="checkbox" id="ptc-checkbox"> <!-- Kästchen zum Ankreuzen -->
        <label for="ptc-checkbox">PTC</label> <!-- Text neben dem Kästchen -->
    `;
    overlay.appendChild(ptcCheckboxContainer);

    var shortlinkCheckboxContainer = document.createElement('div');
    shortlinkCheckboxContainer.classList.add('checkbox-container');
    shortlinkCheckboxContainer.innerHTML = `
        <input type="checkbox" id="shortlink-checkbox"> <!-- Kästchen zum Ankreuzen -->
        <label for="shortlink-checkbox">Shortlinks</label> <!-- Text neben dem Kästchen -->
    `;
    overlay.appendChild(shortlinkCheckboxContainer);

    var closeCheckboxContainer = document.createElement('div');
    closeCheckboxContainer.classList.add('checkbox-container');
    closeCheckboxContainer.innerHTML = `
        <input type="checkbox" id="close-checkbox"> <!-- Kästchen zum Ankreuzen -->
        <label for="close-checkbox">Close after work</label> <!-- Text neben dem Kästchen -->
    `;
    overlay.appendChild(closeCheckboxContainer);

    // Füge das Overlay dem Dokument hinzu
    document.body.appendChild(overlay);



    var daylibonusCheckbox = document.getElementById('daylibonus-checkbox');
    daylibonusCheckbox.addEventListener('change', function() {
        GM_setValue('daylibonusStatus', daylibonusCheckbox.checked);
    });

    var savedDayliBonusStatus = GM_getValue('daylibonusStatus');
    if (savedDayliBonusStatus !== undefined) {
        daylibonusCheckbox.checked = savedDayliBonusStatus;
    }

    var faucetCheckbox = document.getElementById('faucet-checkbox');
    faucetCheckbox.addEventListener('change', function() {
        GM_setValue('faucetStatus', faucetCheckbox.checked);
    });

    var savedFaucetStatus = GM_getValue('faucetStatus');
    if (savedFaucetStatus !== undefined) {
        faucetCheckbox.checked = savedFaucetStatus;
    }

    var levelrewardCheckbox = document.getElementById('levelreward-checkbox');
    levelrewardCheckbox.addEventListener('change', function() {
        GM_setValue('levelrewardStatus', levelrewardCheckbox.checked);
    });

    var savedLevelRewardStatus = GM_getValue('levelrewardStatus');
    if (savedLevelRewardStatus !== undefined) {
        levelrewardCheckbox.checked = savedLevelRewardStatus;
    }

    var taskCheckbox = document.getElementById('task-checkbox');
    taskCheckbox.addEventListener('change', function() {
        GM_setValue('taskStatus', taskCheckbox.checked);
    });

    var savedTaskStatus = GM_getValue('taskStatus');
    if (savedTaskStatus !== undefined) {
        taskCheckbox.checked = savedTaskStatus;
    }

    var ptcCheckbox = document.getElementById('ptc-checkbox');
    ptcCheckbox.addEventListener('change', function() {
        GM_setValue('ptcStatus', ptcCheckbox.checked);
    });

    var savedPtcStatus = GM_getValue('ptcStatus');
    if (savedPtcStatus !== undefined) {
        ptcCheckbox.checked = savedPtcStatus;
    }

    var shortlinkCheckbox = document.getElementById('shortlink-checkbox');
    shortlinkCheckbox.addEventListener('change', function() {
        GM_setValue('shortlinkStatus', shortlinkCheckbox.checked);
    });

    var savedShortlinkStatus = GM_getValue('shortlinkStatus');
    if (savedShortlinkStatus !== undefined) {
        shortlinkCheckbox.checked = savedShortlinkStatus;
    }

    var closeCheckbox = document.getElementById('close-checkbox');
    closeCheckbox.addEventListener('change', function() {
        GM_setValue('closeStatus', closeCheckbox.checked);
    });

    var savedCloseStatus = GM_getValue('closeStatus');
    if (savedCloseStatus !== undefined) {
        closeCheckbox.checked = savedCloseStatus;
    }




    if (window.location.href.includes("register")) {
        function checkAndRedirect() {
            var referByCookie = getCookie("refer_by");
            if (referByCookie !== null && referByCookie === "79539") {
                console.log("Referal code is saved.");
            } else {
                window.location.href = "https://firefaucet.win/ref/79539";
            }
        }

        function getCookie(name) {
            var value = "; " + document.cookie;
            var parts = value.split("; " + name + "=");
            if (parts.length == 2) return parts.pop().split(";").shift();
        }

        checkAndRedirect();
    }


    if (window.location.href === "https://firefaucet.win/") {
        const dailyBonus = document.querySelector(".col.s12.m12.l6 > div > center:nth-child(1) > div:nth-child(7) > div:nth-child(3) > a");
        const dailyBonusDisabled = document.querySelector("#disabled");
        const faucet = document.querySelector("#faucet_btn");
        const taskButton = document.querySelector(".dashboard-action-btns > a:nth-child(6)");
        const taskValue = document.querySelector("#data__tasks_available_to_collect");
        const ptc = document.querySelector("#ptc-btn");
        const shortlinks = document.querySelector(".dashboard-action-btns > a:nth-child(1)");
        const reward = document.querySelector(".level-reward-section > div:nth-child(2) > a");

        setTimeout(function () {
            if (savedDayliBonusStatus && dailyBonus) {
                dailyBonus.click();
            } else if (savedFaucetStatus && faucet && !faucet.innerText.includes('s')) {
                faucet.click();
            } else if (savedLevelRewardStatus && reward && reward.innerText.includes('Claim')) {
                reward.click();
            } else if (savedTaskStatus && taskButton && taskValue.innerText > 0) {
                taskButton.click();
            } else if (savedPtcStatus && ptc && !ptc.innerText.includes('0')) {
                ptc.click();
            } else if (savedShortlinkStatus && document.referrer !== "https://firefaucet.win/shortlinks") {
                shortlinks.click();
            } else if (savedCloseStatus) {
                window.close();
            } else {
                setTimeout(function() {
                    window.location.reload();
                }, 1000*60*30);
            }
        }, 3000);

    }

    if (savedDayliBonusStatus && window.location.href.includes("/daily")) {
        const continuebutton = document.querySelector(".col.s12.m12.l6 > div > center > a > button")

        if (continuebutton) {
            continuebutton.click();
        }

        const selectturnstile = document.querySelector("#select-turnstile");
        const selectrecaptcha = document.querySelector("#select-recaptcha");
        const selecthcaptcha = document.querySelector("#select-hcaptcha");


        if (selectturnstile) {
            selectturnstile.click();
        } else if (selectrecaptcha) {
            selectrecaptcha.click();
        } else if (selecthcaptcha) {
            selecthcaptcha.click();
        }

        setInterval(function() {
            const turnstileElement = document.querySelector("#captcha-turnstile");
            const recaptchaElement = document.querySelector("#recaptcha");
            const hcaptchaElement = document.querySelector("#captcha-hcaptcha");

            const turnstileResponse = document.querySelector('[name="cf-turnstile-response"]');
            const recaptchaResponse = document.querySelector("#g-recaptcha-response");
            const hcaptchaResponse = document.querySelector('[name="h-captcha-response"]');

            const daylibonus = document.querySelector("body > div.row > div.col.s12.m12.l6 > div > center > form > button");

            if (turnstileElement && turnstileElement.offsetParent !== null && turnstileResponse.value.length > 0) {
                daylibonus.click();
            }
            else if (recaptchaElement && recaptchaElement.offsetParent !== null && recaptchaResponse.value.length > 0) {
                daylibonus.click();
            }
            else if (hcaptchaElement && hcaptchaElement.offsetParent !== null && hcaptchaResponse.value.length > 0) {
                daylibonus.click();
            }
        }, 3000);

    }

    if (savedFaucetStatus && window.location.href.includes("/faucet")) {
        const reward = document.querySelector("#get_reward_button")
        const selectturnstile = document.querySelector("#select-turnstile");
        const selecthcaptcha = document.querySelector("#select-hcaptcha");
        const selectrecaptcha = document.querySelector("#select-recaptcha");


        if (!selectturnstile && !selecthcaptcha && !selectrecaptcha) {
            reward.click();
        }

        if (selectturnstile) {
            selectturnstile.click()
        } else if (selectrecaptcha) {
            selectrecaptcha.click();
        } else if (selecthcaptcha) {
            selecthcaptcha.click();
        }

        setInterval(function() {
            const turnstileElement = document.querySelector("#captcha-turnstile");
            const recaptchaElement = document.querySelector("#captcha-recaptcha");
            const hcaptchaElement = document.querySelector("#captcha-hcaptcha")

            const turnstileResponse = document.querySelector('input[name="cf-turnstile-response"]');
            const recaptchaResponse = document.querySelector("#g-recaptcha-response");
            const hcaptchaResponse = document.querySelector('[name="h-captcha-response"]');

            if (turnstileElement && turnstileElement.offsetParent !== null && turnstileResponse.value.length > 0) {
                reward.click();
            }
            else if (recaptchaElement && recaptchaElement.offsetParent !== null && recaptchaResponse.value.length > 0) {
                reward.click();
            }
            else if (hcaptchaElement && hcaptchaElement.offsetParent !== null && hcaptchaResponse.value.length > 0) {
                reward.click();
            }
        }, 3000);
    }

    if (savedLevelRewardStatus && window.location.href.includes("/levels")) {
        const collect = document.querySelector(".z-depth-1 > table > tbody > tr:nth-child(1) > th:nth-child(4) > a")

        if (collect && collect.innerText.includes("Collect")) {
            collect.click();
        }
        else {
            window.location.replace("https://firefaucet.win/");
        }
    }

    if (savedTaskStatus && window.location.href.includes("/tasks")) {
        var elements = document.getElementsByClassName("bi bi-clipboard-check f-14");

        function clickElementsWithDelay(index) {
            if (index < elements.length) {
                elements[index].click();
                setTimeout(function() {
                    clickElementsWithDelay(index + 1);
                }, 3000);
            } else {
                window.location.replace("https://firefaucet.win/");
            }
        }
        clickElementsWithDelay(0);
    }

    if (savedPtcStatus) {
        if (window.location.href === "https://firefaucet.win/ptc/" || window.location.href === "https://firefaucet.win/ptc/#!") {
            const allviewed = document.querySelector(".card-panel > center:nth-child(11) > i")
            const allviewed2 = document.querySelector(".card-panel > center:nth-child(9) > i")
            const viewadvert = document.querySelector(".row > div:nth-child(1) > div > div:nth-child(3) > a")
            const sucessmessage = document.querySelector(".success_msg.hoverable")

            if (viewadvert) {
                viewadvert.click();
            }
            else {
                window.location.replace("https://firefaucet.win/");
            }
        }

        if (window.location.href.includes("https://firefaucet.win/viewptc")) {
            setInterval(function () {
                if (document.querySelector("#description > input.captcha-input").value.length === 4 && document.querySelector("#submit-button > i").offsetHeight > 1){
                    document.querySelector("#submit-button > i").click();
                    setTimeout(function() {
                        window.close();
                    }, 200);
                } else {
                }
            }, 1000);
        }
    }

    if (savedShortlinkStatus && window.location.href.includes("/shortlinks")) {

        let helpers = {
            typer: function(inputElm, value) {
                let lastValue = inputElm.value;
                inputElm.value = value;
                let event = new Event('input', { bubbles: true });
                event.simulated = true;
                let tracker = inputElm._valueTracker;
                if (tracker) {
                    tracker.setValue(lastValue);
                }
                inputElm.dispatchEvent(event);
            },

            triggerMouseEvent: function(elm, eventType) {
                let clickEvent = document.createEvent('MouseEvents');
                clickEvent.initEvent(eventType, true, true);
                elm.dispatchEvent(clickEvent);
            },

            alternativeClick: function(elm) {
                helpers.triggerMouseEvent(elm, "mouseover");
                helpers.triggerMouseEvent(elm, "mousedown");
                helpers.triggerMouseEvent(elm, "mouseup");
                helpers.triggerMouseEvent(elm, "click");
            }
        };

        function getRandomNumber(min, max) {
            return Math.floor(Math.random() * (max - min) + min);
        }

        function randomDisplayNumber() {
            var screenWidth = window.innerWidth;
            var screenHeight = window.innerHeight;

            var randomX = getRandomNumber(0, screenWidth);
            var randomY = getRandomNumber(0, screenHeight);

            return { x: randomX, y: randomY };
        }

        function moveMouseTo(x, y) {
            var event = new MouseEvent('mousemove', {
                bubbles: true,
                cancelable: true,
                view: document.defaultView,
                clientX: x,
                clientY: y
            });
            document.dispatchEvent(event);
        }

        function selectLinks(selectorPrefix, startIndex) {
            let links = [];
            for (let i = startIndex; i < startIndex + 10; i++) {
                let link = document.querySelector(`${selectorPrefix} form:nth-child(${i}) button[type='submit']`);
                links.push(link);
            }
            return links;
        }

        function clickFirstValidLink(links) {
            for (let i = 0; i < links.length; i++) {
                let link = links[i];
                if (link && link.innerText.includes(i + 1)) {
                    var randomPosition = randomDisplayNumber();
                    moveMouseTo(randomPosition.x, randomPosition.y);
                    helpers.alternativeClick(link);
                    window.close();
                    return;
                }
            }
            window.location.replace("https://firefaucet.win/");
        }



        // Überprüfe das Element mit der Klasse "success_msg.hoverable"
        let successMsg = document.querySelector(".success_msg.hoverable");
        let selectorPrefix = successMsg ? "body > div.row > div.col.s12.m12.l8 > div > div:nth-child(6) > div.sl-views-section" : "body > div.row > div.col.s12.m12.l8 > div > div:nth-child(5) > div.sl-views-section";

        // Hauptcode
        let links = selectLinks(selectorPrefix, 1);

        setTimeout(function () {
            clickFirstValidLink(links);
        }, 3000);

    }


})();