Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name [ꜱɪ] ꜱᴋᴀʟᴏᴡᴀɴɪᴇ ᴄᴀᴘᴛᴄʜᴀ
- // @version 1.1
- // @description Skaluje okno CAPTCHA do wielkości okna
- // @author Nolifequ
- // @icon https://i.ibb.co/txqmHDz/google-recaptcha-logo-icon-170062.png
- // @match https://fobos.margonem.pl/
- // ==/UserScript==
- (function () {
- 'use strict';
- let monitoringInterval;
- function scaleCaptchaToFitWindow(captchaElement) {
- if (captchaElement) {
- const rect = captchaElement.getBoundingClientRect();
- const windowWidth = window.innerWidth;
- const windowHeight = window.innerHeight;
- const scaleWidth = windowWidth / rect.width;
- const scaleHeight = windowHeight / rect.height;
- const scale = Math.min(scaleWidth, scaleHeight);
- captchaElement.style.transform = `scale(${scale})`;
- captchaElement.style.transformOrigin = 'top left';
- captchaElement.style.position = 'absolute';
- captchaElement.style.top = '0';
- captchaElement.style.left = '0';
- captchaElement.style.zIndex = '9999';
- console.log(`CAPTCHA przeskalowana: scale(${scale})`);
- }
- }
- function monitorCaptcha() {
- const captchaElement = document.getElementById('captcha');
- if (captchaElement) {
- const rect = captchaElement.getBoundingClientRect();
- if (rect.width > 0 && rect.height > 0) {
- console.log('CAPTCHA wykryta i gotowa do skalowania.');
- scaleCaptchaToFitWindow(captchaElement);
- clearInterval(monitoringInterval);
- monitoringInterval = null;
- return;
- }
- }
- console.log('CAPTCHA jeszcze niegotowa, kontynuuję monitorowanie.');
- }
- function startMonitoring() {
- if (!monitoringInterval) {
- monitoringInterval = setInterval(monitorCaptcha, 100);
- }
- }
- const observer = new MutationObserver((mutations) => {
- mutations.forEach((mutation) => {
- mutation.addedNodes.forEach((node) => {
- if (node.id === 'captcha') {
- console.log('CAPTCHA została dodana do DOM.');
- startMonitoring();
- }
- });
- });
- });
- observer.observe(document.body, {
- childList: true,
- subtree: true,
- });
- window.addEventListener('resize', () => {
- const captchaElement = document.getElementById('captcha');
- if (captchaElement) {
- startMonitoring();
- }
- });
- setTimeout(() => {
- const captchaElement = document.getElementById('captcha');
- if (captchaElement) {
- console.log('Rezerwowe wykrycie CAPTCHA.');
- startMonitoring();
- }
- }, 100);
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement