// ==UserScript== // @name reCAPTCHA fix // @version 3 // @author Bladru // @description Works around Opera bug triggered by Google obfuscator // ==/UserScript== /* Opera only. Save as "recaptcha_fix.js" (without .user). Opera bug: (function(o){(console.log("foo"),o).x*=1})({}); */ (function(){ var start = Date.now(); window.opera.addEventListener("BeforeScript", patch_scripts); function patch_scripts(UserJSEvent){ var script = UserJSEvent.element; if (script.src.indexOf("gstatic.com/recaptcha/") == -1) return; /* if (typeof performance !== "object") window.performance = {}; if (typeof performance.now !== "function") window.performance.now = function(){ return Date.now() - start; } */ /* ,U).width*= ),U.width*= */ // var pattern = /(,\s*[\w$]+\s*)\)(\s*\.\s*(?:width|height)\s*[*/%+\-&^|]=)/g; var pattern = /(,\s*[\w$]+\s*)\)(\s*\.\s*[\w$]+\s*[*/%+\-&^|]=)/g; var fixed = ")$1$2"; if (pattern.test(script.text)){ var matches = script.text.match(pattern); console.log("[reCAPTCHA fix] replacing " + matches.length + " matches in " + script.src, matches); script.text = script.text.replace(pattern, fixed); } } })(); |