[New] Bitcotasks PTC by Andrewblood

Open and close the PTC

目前为 2024-12-03 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name [New] Bitcotasks PTC by Andrewblood
  3. // @namespace https://greasyfork.org/users/1162863
  4. // @version 1.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. function specialClick(selector) {
  21. var interval001 = setInterval(function() {
  22. // Wähle den Button anhand des Selektors
  23. var button = document.querySelector(selector);
  24. // Wähle das CAPTCHA-Element und das Response-Element
  25. var captchaElement = document.querySelector(".captcha-modal, .g-recaptcha, .h-captcha");
  26. var captchaResponse = document.querySelector("#g-recaptcha-response, #g-recaptcha-response, #fform > center > div > div > input[type=hidden]");
  27.  
  28. // Überprüfe, ob das CAPTCHA-Element vorhanden ist
  29. if (captchaElement) {
  30. // Falls das CAPTCHA ausgefüllt ist und der Button sichtbar und aktiv ist, klicke den Button
  31. if (captchaResponse && captchaResponse.value.length > 0 && button && button.offsetHeight > 0 && !button.hasAttribute('disabled')) {
  32. button.click();
  33. console.log("Element is clicked.");
  34. clearInterval(interval001);
  35. }
  36. } else {
  37. // Falls kein CAPTCHA vorhanden ist, überprüfe nur die Sichtbarkeit des Buttons
  38. if (button && button.offsetHeight > 0 && !button.hasAttribute('disabled')) {
  39. button.click();
  40. console.log("Element is clicked.");
  41. clearInterval(interval001);
  42. }
  43. }
  44. }, 500);
  45. }
  46.  
  47. // Überprüfen, ob der Titel der Seite 'Just a Moment' in verschiedenen Sprachen ist
  48. var titles = [
  49. 'Just a moment', // Englisch
  50. '稍等片刻', // Chinesisch
  51. 'Een ogenblik', // Holländisch
  52. 'Un instant', // Französisch
  53. 'Nur einen Moment', // Deutsch
  54. 'Un momento', // Italienisch
  55. 'Um momento', // Portugiesisch
  56. 'Bir an', // Türkisch
  57. ];
  58.  
  59. // Überprüfen, ob der Titel einen der Strings enthält
  60. if (titles.some(title => document.title.includes(title))) {
  61. console.log('Cloudflare-Challenger-Seite erkannt. Skript wird nicht ausgeführt.');
  62.  
  63. } else {
  64.  
  65. var checkForClaimLimit = ("#faucetContent > h3");
  66. var loadingSite = ("#main-content > div > h3");
  67.  
  68. // ReCaptcha Firewall
  69. if (window.location.href.includes("firewall")){
  70. specialClick(".btn.btn-primary.btn-block");
  71. }
  72.  
  73. // Ads Overlay
  74. if (window.location.href.includes("offerwall")){
  75. GM_setValue('adActive', false);
  76.  
  77. setInterval(function() {
  78. if (GM_getValue('adActive') === false && document.querySelector(".card.mb-3.mt-1.campaign-block:not(.clicked)")) {
  79. specialClick(".card.mb-3.mt-1.campaign-block:not(.clicked)");
  80. GM_setValue('adActive', true);
  81. } else if (GM_getValue('adActive') === false && !document.querySelector(".card.mb-3.mt-1.campaign-block:not(.clicked)")){
  82. window.close();
  83. console.log("Wait for next Ad.");
  84. }
  85. }, 3000);
  86.  
  87. // Faucet
  88. specialClick(".btn.btn-lg.btn-primary");
  89. }
  90.  
  91. // PTC ansehem
  92. if (window.location.href.includes("/lead/")){
  93.  
  94. // not aviable ad schliessen
  95. if (window.location.href.includes("not_available")){
  96. GM_setValue('adActive', false);
  97. window.close();
  98. }
  99.  
  100. var oldFunction = unsafeWindow.open;
  101. var lastOpenedWindow = null;
  102.  
  103. function newFunction(url, target) {
  104. var windowName = (target && target !== "_blank") ? target : "popUpWindow";
  105. lastOpenedWindow = oldFunction(url, windowName);
  106. return lastOpenedWindow;
  107. }
  108. unsafeWindow.open = newFunction;
  109.  
  110. // Open view Ad in new window
  111. specialClick(".btn-primary.btn");
  112.  
  113. setInterval(function() {
  114. if (document.querySelector("#status > div") && document.querySelector("#status > div").innerText.includes("SUCCESS")){
  115. GM_setValue('adActive', false);
  116. lastOpenedWindow.close();
  117. lastOpenedWindow = null;
  118. window.close();
  119. }
  120. }, 100);
  121.  
  122. let interval1 = setInterval(function() {
  123. if (document.title.includes('Claim Reward!')){
  124. window.focus();
  125. clearInterval(interval1);
  126. }
  127. }, 1000);
  128.  
  129. }
  130. }
  131. })();