// ==UserScript== // @name [New] Bitcotasks // @namespace https://greasyfork.org/users/1162863 // @version 1.0 // @description Open and close the PTC // @author Andrewblood // @match *://*.bitcotasks.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=bitcotasks.com // @grant GM_setValue // @grant GM_getValue // @grant window.focus // @grant window.close // @grant unsafeWindow // @license Copyright Andrewblood // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Functions for REAL Click function triggerMouseEvent(elm, eventType) { let clickEvent = document.createEvent('MouseEvents'); clickEvent.initEvent(eventType, true, true); elm.dispatchEvent(clickEvent); } function alternativeClick(elm) { triggerMouseEvent(elm, "mouseover"); triggerMouseEvent(elm, "mousedown"); triggerMouseEvent(elm, "mouseup"); triggerMouseEvent(elm, "click"); } function specialClick(selector) { var interval001 = setInterval(function() { // Wähle den Button anhand des Selektors var button = document.querySelector(selector); // Wähle das CAPTCHA-Element und das Response-Element var captchaElement = document.querySelector(".captcha-modal, .g-recaptcha, .h-captcha"); var captchaResponse = document.querySelector("#g-recaptcha-response, #g-recaptcha-response, #fform > center > div > div > input[type=hidden]"); // Überprüfe, ob das CAPTCHA-Element vorhanden ist if (captchaElement) { // Falls das CAPTCHA ausgefüllt ist und der Button sichtbar und aktiv ist, klicke den Button if (captchaResponse && captchaResponse.value.length > 0 && button && button.offsetHeight > 0 && !button.hasAttribute('disabled')) { alternativeClick(button); console.log("Element is clicked."); clearInterval(interval001); } } else { // Falls kein CAPTCHA vorhanden ist, überprüfe nur die Sichtbarkeit des Buttons if (button && button.offsetHeight > 0 && !button.hasAttribute('disabled')) { alternativeClick(button); console.log("Element is clicked."); clearInterval(interval001); } } }, 500); } var checkForClaimLimit = ("#faucetContent > h3"); var loadingSite = ("#main-content > div > h3"); // ReCaptcha Firewall if (window.location.href.includes("firewall")){ specialClick(".btn.btn-primary.btn-block"); } // Ads Overlay if (window.location.href.includes("offerwall")){ GM_setValue('adActive', false); setInterval(function() { if (GM_getValue('adActive') === false && document.querySelector(".card.mb-3.mt-1.campaign-block:not(.clicked)")) { specialClick(".card.mb-3.mt-1.campaign-block:not(.clicked)"); GM_setValue('adActive', true); } else if (GM_getValue('adActive') === false && !document.querySelector(".card.mb-3.mt-1.campaign-block:not(.clicked)")){ window.close(); console.log("Wait for next Ad."); } }, 3000); // Faucet specialClick(".btn.btn-lg.btn-primary"); } // PTC ansehem if (window.location.href.includes("//lead/")){ // Funktion für das Schließen der Tabs var oldFunction = unsafeWindow.open; var lastOpenedWindow = null; // Variable zur Speicherung des zuletzt geöffneten Fensters function newFunction(url, target) { // Setze den Namen des Fensters var windowName = (target && target !== "_blank") ? target : "popUpWindow"; // Öffne das Fenster und speichere die Referenz lastOpenedWindow = oldFunction(url, windowName); return lastOpenedWindow; } unsafeWindow.open = newFunction; // Schließe das letzte geöffnete Fenster, wenn die Seite verlassen wird unsafeWindow.onbeforeunload = function() { if (lastOpenedWindow) { lastOpenedWindow.close(); // Schließe das Fenster lastOpenedWindow = null; // Setze die Referenz zurück } }; // Open view Ad in new window specialClick(".btn-primary.btn"); // Funktion für das fokusieren des Tabs let interval1 = setInterval(function() { if (document.title.includes('Claim Reward!')){ window.focus(); clearInterval(interval1); } }, 500); // Ad nach Captcha schliessen setInterval(function() { if (document.querySelector("#captcha-result") && document.querySelector("#captcha-result").offsetHeight > 0 && document.querySelector("#captcha-result").innerText == "Verified!"){ GM_setValue('adActive', false); window.close(); } }, 500); } })();