Onlyfaucet Auto Faucet

Automatically Login and Click Faucet

  1. // ==UserScript==
  2. // @name Onlyfaucet Auto Faucet
  3. // @namespace bekerja pada tampermonkey maupun violentmonkey
  4. // @version 0.3
  5. // @autor Ojo Ngono
  6. // @description Automatically Login and Click Faucet
  7. // @grant GM_getValue
  8. // @grant GM_setValue
  9. // @grant GM_addStyle
  10. // @grant GM_registerMenuCommand
  11. // @require https://update.greatest.deepsurf.us/scripts/439099/1203718/MonkeyConfig%20Modern%20Reloaded.js
  12. // @match *://onlyfaucet.com/*
  13. // @antifeature referral-link Directs to a referral link when not logged in
  14. // @license Copyright OjoNgono
  15. // ==/UserScript==
  16.  
  17. const cfg = new MonkeyConfig({
  18. title: 'Input Email Faucetpay:',
  19. menuCommand: true,
  20. params: {
  21. Announcements: {
  22. type: 'text',
  23. default: 'Input Email Faucetpay',
  24. long: 3,
  25. },
  26. Email: {
  27. label: "Email Faucetpay",
  28. type: "text",
  29. default: '',
  30. },
  31. }
  32. });
  33.  
  34. (function() {
  35. 'use strict';
  36.  
  37. window.addEventListener('load', () => {
  38. const email = cfg.get('Email');
  39. if (!email || email.trim() === '') {
  40. enforceLogoutWithWarning();
  41. } else {
  42. enforceReferralUrl();
  43. setTimeout(clickLoginRegisterButton, 1000);
  44. const loginInterval = setInterval(handleLoginPopup, 1000);
  45. setTimeout(() => {
  46. clearInterval(loginInterval);
  47. startClaimProcess();
  48. }, 10000);
  49. }
  50. });
  51.  
  52. function enforceReferralUrl() {
  53. const url = window.location.href;
  54. if (url.startsWith("https://onlyfaucet.com/") && !url.includes("?r=29298")) {
  55. const loggedIn = document.querySelector("#logoutModal");
  56. if (!loggedIn) {
  57. window.location.replace("https://onlyfaucet.com/?r=29298");
  58. }
  59. }
  60. }
  61.  
  62. function enforceLogoutWithWarning() {
  63. const loggedIn = document.querySelector("#logoutModal");
  64. if (loggedIn) {
  65. alert('Please enter your email in the settings menu before using MY SCRIPT.');
  66. const logoutButton = document.querySelector('a[href="https://onlyfaucet.com/auth/logout"]');
  67. if (logoutButton) {
  68. logoutButton.click();
  69. } else {
  70. window.location.replace("https://onlyfaucet.com/auth/logout");
  71. }
  72. }
  73. }
  74.  
  75. function clickLoginRegisterButton() {
  76. const loginButton = document.querySelector('span.mb-0');
  77. if (loginButton && loginButton.textContent.includes('Login / Register')) {
  78. loginButton.click();
  79. }
  80. }
  81.  
  82. function handleLoginPopup() {
  83. const modalTitle = document.querySelector('.modal-title');
  84. if (modalTitle && modalTitle.textContent.includes('Login')) {
  85. const emailInput = document.querySelector('#InputEmail');
  86. if (emailInput) {
  87. emailInput.value = cfg.get('Email');
  88. }
  89.  
  90. detectAuthKongCaptcha();
  91. }
  92. }
  93.  
  94. function detectAuthKongCaptcha() {
  95. const captchaElement = document.querySelector('.authkong_captcha');
  96. if (captchaElement) {
  97.  
  98. checkCaptchaSolved();
  99. } else {
  100. clickContinueButton();
  101. }
  102. }
  103.  
  104. function checkCaptchaSolved() {
  105. const captchaResponse = document.querySelector('input[name="captcha-response"]');
  106. if (captchaResponse && captchaResponse.value) {
  107. clickContinueButton();
  108. } else {
  109. setTimeout(checkCaptchaSolved, 1000);
  110. }
  111. }
  112.  
  113. function clickContinueButton() {
  114. const continueButton = document.querySelector('button.d-flex.align-items-center.btn.btn-outline.border.text-secondary');
  115. if (continueButton) {
  116. continueButton.click();
  117. }
  118. }
  119.  
  120. (function() {
  121. 'use strict';
  122.  
  123. function detectAuthKongCaptcha() {
  124. const captchaElement = document.querySelector('.authkong_captcha');
  125. if (captchaElement) {
  126. checkCaptchaSolved();
  127. }
  128. }
  129.  
  130. function checkCaptchaSolved() {
  131. const captchaResponse = document.querySelector('input[name="captcha-response"]');
  132. if (captchaResponse && captchaResponse.value) {
  133. clickUnlockButton();
  134. } else {
  135. setTimeout(checkCaptchaSolved, 1000);
  136. }
  137. }
  138.  
  139. function clickUnlockButton() {
  140. const unlockButton = document.querySelector('button.btn.btn-primary.w-md');
  141. if (unlockButton) {
  142. unlockButton.click();
  143. }
  144. }
  145.  
  146. window.addEventListener('load', () => {
  147. detectAuthKongCaptcha();
  148. });
  149.  
  150. const observer = new MutationObserver(() => {
  151. detectAuthKongCaptcha();
  152. });
  153. observer.observe(document.body, { childList: true, subtree: true });
  154.  
  155. })();
  156. function clickButtonByTextWithDelay(text, delay) {
  157. const buttons = document.querySelectorAll('button, a');
  158. buttons.forEach((button) => {
  159. if (button.textContent.trim().toLowerCase() === text.toLowerCase()) {
  160.  
  161. setTimeout(() => {
  162. button.click();
  163. window.scrollTo(0, document.body.scrollHeight / 2);
  164. }, delay);
  165. }
  166. });
  167. }
  168.  
  169. const observer = new MutationObserver(() => {
  170. clickButtonByTextWithDelay('Claim Now', 500);
  171. });
  172. observer.observe(document.body, { childList: true, subtree: true });
  173.  
  174. function checkForMessage() {
  175. const swalContainer = document.querySelector('#swal2-html-container');
  176. if (swalContainer && swalContainer.style.display === 'block') {
  177. const pageText = swalContainer.innerText || "";
  178. const targetMessage = "You must complete at least 1 Shortlink to continue";
  179. if (cleanText(pageText).includes(targetMessage)) {
  180. setTimeout(() => {
  181. const currentUrl = window.location.href;
  182. const match = currentUrl.match(/https:\/\/onlyfaucet.com\/faucet\/currency\/(\w+)/);
  183. if (match) {
  184. const currency = match[1];
  185. window.location.href = `https://onlyfaucet.com/links/currency/${currency}`;
  186. }
  187. }, 1000);
  188. }
  189. }
  190. }
  191.  
  192. function cleanText(text) {
  193. return text.replace(/\s+/g, ' ').trim();
  194. }
  195.  
  196. setInterval(checkForMessage, 1000);
  197. })();
  198.  
  199. function waitForElement(selector, callback) {
  200. const interval = setInterval(() => {
  201. const element = document.querySelector(selector);
  202. if (element) {
  203. clearInterval(interval);
  204. callback(element);
  205. }
  206. }, 100);
  207. }
  208.  
  209. waitForElement('#subbutt', () => {
  210. const button = document.querySelector('#subbutt');
  211. if (button) {
  212.  
  213. window.scrollTo(0, document.body.scrollHeight / 2);
  214. }
  215.  
  216. });