| user254 | f271981 | 2026-02-09 16:50:17 +0900 | [diff] [blame^] | 1 | /** |
| 2 | * This site uses weird type of CAPTCHA. It downloads code from captcha-code.php |
| 3 | * and puts it into span tag to display the code. This script extracts the code |
| 4 | * with MutationObserver and skips entire download form because its only purpose |
| 5 | * is to annoy the user with shitty CAPTCHA. CSS is included to hide the form. |
| 6 | */ |
| 7 | |
| 8 | const ctaBlock = document.querySelector('#cta-block') |
| 9 | const captchaInput = document.querySelector('#captcha') |
| 10 | const downloadForm = document.querySelector('#form_download') |
| 11 | const submitButton = document.querySelector('#form_download button[type=submit]') |
| 12 | |
| 13 | const observer = new MutationObserver((mutationList, observer) => { |
| 14 | for (const mutation of mutationList) { |
| 15 | if (mutation.type === 'childList') { |
| 16 | const code = mutation.addedNodes[0].textContent |
| 17 | console.log('Found and inserted code: ', code) |
| 18 | captchaInput.value = code |
| 19 | console.log('Submitting download form') |
| 20 | downloadForm.requestSubmit(submitButton) |
| 21 | } |
| 22 | } |
| 23 | }) |
| 24 | observer.observe(ctaBlock, { |
| 25 | childList: true, |
| 26 | subtree: true |
| 27 | }) |
| 28 | |
| 29 | console.log('observer installed: ', observer) |