From c41eebac87e956da4b6e98718887703056e847a2 Mon Sep 17 00:00:00 2001 From: haunter Date: Tue, 21 Apr 2026 19:25:36 +0300 Subject: [PATCH] cap fix --- GrepolisRemoteControl.user.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/GrepolisRemoteControl.user.js b/GrepolisRemoteControl.user.js index 41cb0d4..353c07e 100644 --- a/GrepolisRemoteControl.user.js +++ b/GrepolisRemoteControl.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Grepolis Remote Control // @namespace http://tampermonkey.net/ -// @version 2.5 +// @version 2.6 // @description Polls grepo.haunter-pets.top for remote commands and executes them in-game // @author Dimitrios // @match https://*.grepolis.com/game/* @@ -295,9 +295,19 @@ } function detectCaptcha() { - const observer = new MutationObserver(() => { - const hasWindow = !!document.getElementById('hcaptcha_window'); - if (hasWindow && !captchaActive) { + setInterval(() => { + const win = document.getElementById('hcaptcha_window'); + let isVisible = false; + + if (win) { + // Check if it's actually visible on screen (not display: none by the game) + const style = window.getComputedStyle(win); + if (style.display !== 'none' && style.visibility !== 'hidden') { + isVisible = true; + } + } + + if (isVisible && !captchaActive) { captchaActive = true; paused = true; const label = document.getElementById('grc_label'); @@ -306,14 +316,13 @@ if (btn) btn.style.filter = 'brightness(70%) sepia(100%) hue-rotate(300deg) saturate(1000%) contrast(0.8)'; log('⚠ CAPTCHA detected — bot paused, alerting server'); reportCaptcha(true); - } else if (!hasWindow && captchaActive) { + } else if (!isVisible && captchaActive) { captchaActive = false; // Don't auto-resume — let the user click the button manually log('✅ Captcha resolved — alert cleared (bot remains paused)'); reportCaptcha(false); } - }); - observer.observe(document.body, { childList: true, subtree: false }); + }, 1000); } // ----------------------------------------------------------------