Greasy Fork is available in English.

Captcha Detector

Deteksi CAPTCHA dan otomatis menekan tombol setelah muncul

  1. // ==UserScript==
  2. // @name Captcha Detector
  3. // @version 1.30
  4. // @description Deteksi CAPTCHA dan otomatis menekan tombol setelah muncul
  5. // @include https://*/game.php*
  6. // @run-at document-end
  7. // @namespace https://greatest.deepsurf.us/users/1388863
  8. // ==/UserScript==
  9.  
  10. (function () {
  11. 'use strict';
  12.  
  13. function startCountdownAndRedirect(durationMinutes) {
  14. const countdownDiv = document.createElement('div');
  15. countdownDiv.style.position = 'fixed';
  16. countdownDiv.style.bottom = '20px';
  17. countdownDiv.style.right = '20px';
  18. countdownDiv.style.padding = '10px';
  19. countdownDiv.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
  20. countdownDiv.style.color = 'white';
  21. countdownDiv.style.fontSize = '14px';
  22. countdownDiv.style.borderRadius = '5px';
  23. countdownDiv.style.zIndex = 10000;
  24. document.body.appendChild(countdownDiv);
  25.  
  26. let remainingTime = durationMinutes * 60;
  27. const interval = setInterval(() => {
  28. const minutes = Math.floor(remainingTime / 60);
  29. const seconds = remainingTime % 60;
  30. countdownDiv.textContent = `Redirecting in: ${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
  31. remainingTime--;
  32.  
  33. if (remainingTime < 0) {
  34. clearInterval(interval);
  35. document.body.removeChild(countdownDiv);
  36. window.location.href = window.location.href;
  37. }
  38. }, 1000);
  39. }
  40.  
  41. function CaptchaDetection() {
  42. console.log("Mendeteksi Bot Check...");
  43.  
  44. const captchaButton = document.querySelector('.btn.btn-default');
  45.  
  46. if (captchaButton) {
  47. console.log("Bot check ditemukan.");
  48.  
  49. const delay = Math.random() * 10 + 10;
  50. console.log(`Menunggu ${Math.floor(delay)} detik sebelum menekan tombol CAPTCHA.`);
  51.  
  52. setTimeout(() => {
  53. captchaButton.click();
  54. console.log("Tombol CAPTCHA diklik.");
  55. startCountdownAndRedirect(Math.floor(Math.random() * 3) + 1); // 1-3 menit
  56. }, delay * 1000);
  57. } else {
  58. console.warn("Tombol CAPTCHA tidak ditemukan. Menunggu...");
  59. observeCaptcha(); // Jalankan observer jika belum ada CAPTCHA
  60. }
  61. }
  62.  
  63. function observeCaptcha() {
  64. const observer = new MutationObserver(() => {
  65. const captchaButton = document.querySelector('.btn.btn-default');
  66. if (captchaButton) {
  67. console.log("Elemen CAPTCHA ditemukan, menjalankan CaptchaDetection...");
  68. observer.disconnect(); // Hentikan observer setelah CAPTCHA ditemukan
  69. CaptchaDetection();
  70. }
  71. });
  72.  
  73. observer.observe(document.body, { childList: true, subtree: true });
  74. }
  75.  
  76. // Jalankan deteksi awal, jika tidak ada CAPTCHA, gunakan observer
  77. if (document.readyState === "complete") {
  78. CaptchaDetection();
  79. } else {
  80. window.addEventListener("load", CaptchaDetection);
  81. }
  82.  
  83. })();