// ==UserScript== // @name 4chan(nel) fallback captcha // @author sanya_v_litvyak // @version 0.1.1 // @description fallback captcha for native extension // @include http://boards.4chan.org/* // @include https://boards.4chan.org/* // @include http://boards.4channel.org/* // @include https://boards.4channel.org/* // @run-at document-end // @namespace https://greasyfork.org/users/173264 // @downloadURL none // ==/UserScript== // >>>>>>>>>>>>>>>>>>>>>>>>>>READ THIS OTHERWISE IT WON'T WORK<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // This will work only if scripts from google.com is blocked. (and for good reason) // Add the following to ad blocker filter: // ||www.google.com/recaptcha/api.js*$script,domain=boards.4channel.org|boards.4chan.org,important (function() { 'use strict'; //ref https://pastebin.com/jYZUJKvb function fixCaptcha(){ var url = "https://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc&hl=en", answerBox = '
'; var iframe = document.createElement('iframe'); var name = "#qrCaptchaContainer"; //var name = "#g-recaptcha"; document.querySelector(name).appendChild(iframe); document.querySelector(name + " iframe").setAttribute("src", url); document.querySelector(name + " iframe").height = "350px;"; document.querySelector(name).setAttribute("style", "height: 350px;"); document.querySelector(name).insertAdjacentHTML("beforeend", answerBox); } var bdNode = document.documentElement || document.body; var config = { childList: true, subtree: true }; var callback = function(mutationsList, observer) { for(var mutation of mutationsList) { if (mutation.type == 'childList') { for(var node of mutation.addedNodes) { if (node.id == 'qr' || node.id == 'quickReply') { fixCaptcha(); } } } } }; var observer = new MutationObserver(callback); observer.observe(document, config); })();