Initial Commit
diff --git a/content/gooroom.css b/content/gooroom.css new file mode 100644 index 0000000..4cfd1c0 --- /dev/null +++ b/content/gooroom.css
@@ -0,0 +1,5 @@ +/* This css hides download form to remove annoying stuff */ + +#modal-captcha, .modal-backdrop { + display: none !important; +}
diff --git a/content/gooroom.js b/content/gooroom.js new file mode 100644 index 0000000..05b7b94 --- /dev/null +++ b/content/gooroom.js
@@ -0,0 +1,29 @@ +/** + * This site uses weird type of CAPTCHA. It downloads code from captcha-code.php + * and puts it into span tag to display the code. This script extracts the code + * with MutationObserver and skips entire download form because its only purpose + * is to annoy the user with shitty CAPTCHA. CSS is included to hide the form. + */ + +const ctaBlock = document.querySelector('#cta-block') +const captchaInput = document.querySelector('#captcha') +const downloadForm = document.querySelector('#form_download') +const submitButton = document.querySelector('#form_download button[type=submit]') + +const observer = new MutationObserver((mutationList, observer) => { + for (const mutation of mutationList) { + if (mutation.type === 'childList') { + const code = mutation.addedNodes[0].textContent + console.log('Found and inserted code: ', code) + captchaInput.value = code + console.log('Submitting download form') + downloadForm.requestSubmit(submitButton) + } + } +}) +observer.observe(ctaBlock, { + childList: true, + subtree: true +}) + +console.log('observer installed: ', observer)