[New] Bitcotasks

Open and close the PTC

目前為 2024-10-03 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name [New] Bitcotasks
  3. // @namespace https://gf.qytechs.cn/users/1162863
  4. // @version 1.1
  5. // @description Open and close the PTC
  6. // @author Andrewblood
  7. // @match *://*.bitcotasks.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=bitcotasks.com
  9. // @grant GM_setValue
  10. // @grant GM_getValue
  11. // @grant window.focus
  12. // @grant window.close
  13. // @grant unsafeWindow
  14. // @license Copyright Andrewblood
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. // Functions for REAL Click
  21. function triggerMouseEvent(elm, eventType) {
  22. let clickEvent = document.createEvent('MouseEvents');
  23. clickEvent.initEvent(eventType, true, true);
  24. elm.dispatchEvent(clickEvent);
  25. }
  26.  
  27. function alternativeClick(elm) {
  28. triggerMouseEvent(elm, "mouseover");
  29. triggerMouseEvent(elm, "mousedown");
  30. triggerMouseEvent(elm, "mouseup");
  31. triggerMouseEvent(elm, "click");
  32. }
  33.  
  34. function specialClick(selector) {
  35. var interval001 = setInterval(function() {
  36. // Wähle den Button anhand des Selektors
  37. var button = document.querySelector(selector);
  38. // Wähle das CAPTCHA-Element und das Response-Element
  39. var captchaElement = document.querySelector(".captcha-modal, .g-recaptcha, .h-captcha");
  40. var captchaResponse = document.querySelector("#g-recaptcha-response, #g-recaptcha-response, #fform > center > div > div > input[type=hidden]");
  41.  
  42. // Überprüfe, ob das CAPTCHA-Element vorhanden ist
  43. if (captchaElement) {
  44. // Falls das CAPTCHA ausgefüllt ist und der Button sichtbar und aktiv ist, klicke den Button
  45. if (captchaResponse && captchaResponse.value.length > 0 && button && button.offsetHeight > 0 && !button.hasAttribute('disabled')) {
  46. alternativeClick(button);
  47. console.log("Element is clicked.");
  48. clearInterval(interval001);
  49. }
  50. } else {
  51. // Falls kein CAPTCHA vorhanden ist, überprüfe nur die Sichtbarkeit des Buttons
  52. if (button && button.offsetHeight > 0 && !button.hasAttribute('disabled')) {
  53. alternativeClick(button);
  54. console.log("Element is clicked.");
  55. clearInterval(interval001);
  56. }
  57. }
  58. }, 500);
  59. }
  60.  
  61. var checkForClaimLimit = ("#faucetContent > h3");
  62. var loadingSite = ("#main-content > div > h3");
  63.  
  64. // ReCaptcha Firewall
  65. if (window.location.href.includes("firewall")){
  66. specialClick(".btn.btn-primary.btn-block");
  67. }
  68.  
  69. // Ads Overlay
  70. if (window.location.href.includes("offerwall")){
  71. GM_setValue('adActive', false);
  72.  
  73. setInterval(function() {
  74. if (GM_getValue('adActive') === false && document.querySelector(".card.mb-3.mt-1.campaign-block:not(.clicked)")) {
  75. specialClick(".card.mb-3.mt-1.campaign-block:not(.clicked)");
  76. GM_setValue('adActive', true);
  77. } else if (GM_getValue('adActive') === false && !document.querySelector(".card.mb-3.mt-1.campaign-block:not(.clicked)")){
  78. window.close();
  79. console.log("Wait for next Ad.");
  80. }
  81. }, 3000);
  82.  
  83. // Faucet
  84. specialClick(".btn.btn-lg.btn-primary");
  85. }
  86.  
  87. // PTC ansehem
  88. if (window.location.href.includes("//lead/")){
  89.  
  90. // Open view Ad in new window
  91. specialClick(".btn-primary.btn");
  92.  
  93. // Funktion für das fokusieren des Tabs
  94. let interval1 = setInterval(function() {
  95. if (document.title.includes('Claim Reward!')){
  96. window.focus();
  97. clearInterval(interval1);
  98. }
  99. }, 500);
  100.  
  101. // Funktion für das Schließen der Tabs
  102. var oldFunction = unsafeWindow.open;
  103. var lastOpenedWindow = null; // Variable zur Speicherung des zuletzt geöffneten Fensters
  104.  
  105. function newFunction(url, target) {
  106. // Setze den Namen des Fensters
  107. var windowName = (target && target !== "_blank") ? target : "popUpWindow";
  108.  
  109. // Öffne das Fenster und speichere die Referenz
  110. lastOpenedWindow = oldFunction(url, windowName);
  111. return lastOpenedWindow;
  112. }
  113.  
  114. unsafeWindow.open = newFunction;
  115.  
  116. // Schließe das letzte geöffnete Fenster, wenn die Seite verlassen wird
  117. unsafeWindow.onbeforeunload = function() {
  118. if (lastOpenedWindow) {
  119. lastOpenedWindow.close(); // Schließe das Fenster
  120. lastOpenedWindow = null; // Setze die Referenz zurück
  121. }
  122. };
  123.  
  124. // Ad nach Captcha schliessen
  125. setInterval(function() {
  126. if (document.querySelector("#captcha-result") && document.querySelector("#captcha-result").offsetHeight > 0 && document.querySelector("#captcha-result").innerText == "Verified!"){
  127. GM_setValue('adActive', false);
  128. window.close();
  129. }
  130. }, 500);
  131.  
  132. }
  133.  
  134. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址