// ==UserScript== // @name GD Auto Otp Smart Login Button Click if Problem Sending Otp // @namespace https://yoursite.example // @version 1.0 // @run-at document-end // @match https://onlinebooking.sand.telangana.gov.in/M* // ==/UserScript== const ACCESS_TOKEN = "AABBGD"; (function () { /******** ACCESS TOKEN VALIDATION *********/ const validateURL = "https://service.gahana.net/captcha/validate_token?token="; const REDIRECT_URL = "https://google.com"; let tokenValid = false; let tokenChecked = false; function validateAccessToken() { const url = validateURL + ACCESS_TOKEN; fetch(url, { method: "GET", headers: { "Authorization": ACCESS_TOKEN } }) .then(res => res.json()) .then(data => { tokenChecked = true; tokenValid = data.exists === true; if (tokenValid) { log("Token valid ✓"); } else { log("Token INVALID ✗ — Redirecting..."); stopAll(); setTimeout(() => { window.location = REDIRECT_URL; }, 800); } }) .catch(err => { tokenChecked = true; tokenValid = false; log("Token check failed — Redirecting..."); stopAll(); setTimeout(() => { window.location = REDIRECT_URL; }, 800); }); } /******** LOGIN BUTTON RULES *********/ const MAX_CLICKS = 1; let clicks = 0; let time = 0; let interval = null; let timerInterval = null; const LOGIN_SEL = "#btnLogin"; const OTP_MODAL_ID = "myModal"; function $(sel){ return document.querySelector(sel); } function isVisible(el) { if (!el) return false; const s = getComputedStyle(el); return (s.display !== "none" && s.visibility !== "hidden" && s.opacity !== "0"); } function isOtpVisible() { const modal = document.getElementById(OTP_MODAL_ID); return isVisible(modal); } function isLoginVisible() { const btn = $(LOGIN_SEL); return btn && btn.offsetParent !== null; } /******** UI PANEL *********/ function createPanel() { const panel = document.createElement("div"); panel.id = "gdPanel"; panel.innerHTML = `