1(function () { 2 function findCaptchaElements(node) { 3 if (node.querySelectorAll) { 4 return node.querySelectorAll(".frc-captcha"); 5 } else { 6 return []; 7 } 8 } 9 10 function setupV1CaptchaElements(node) { 11 let autoWidget = window.friendlyChallenge.autoWidget; 12 13 const elements = findCaptchaElements(node); 14 for (let i = 0; i < elements.length; i++) { 15 const hElement = elements[i]; 16 17 // friendly-challenge adds the "friendlyChallengeWidget" property to the element when it's initialized 18 if (hElement && !hElement.friendlyChallengeWidget) { 19 autoWidget = new window.friendlyChallenge.WidgetInstance(hElement); 20 } 21 } 22 23 window.friendlyChallenge.autoWidget = autoWidget; 24 } 25 26 function setupV2CaptchaElements(node) { 27 const elements = findCaptchaElements(node); 28 for (let i = 0; i < elements.length; i++) { 29 const element = elements[i]; 30 31 // friendly-captcha-sdk adds the "frcWidget" property to the element when it's initialized 32 if (element && !element.frcWidget) { 33 // If the widget was initialized before and then re-inserted into the DOM, the iframe will still be there 34 // We remove any existing content to make sure we end up with exactly one iframe 35 element.innerHTML = ""; 36 window.frcaptcha.attach(element); 37 } 38 } 39 } 40 41 const observer = new MutationObserver((mutationList) => { 42 for (let m = 0; m < mutationList.length; m++) { 43 const mutation = mutationList[m]; 44 45 const nodes = mutation.addedNodes; 46 for (let n = 0; n < nodes.length; n++) { 47 if (window.friendlyChallenge) { 48 setupV1CaptchaElements(nodes[n]); 49 } else if (window.frcaptcha) { 50 setupV2CaptchaElements(nodes[n]); 51 } 52 } 53 } 54 }); 55 56 function init() { 57 // Start observing the document body for changes 58 observer.observe(document.body, { 59 attributes: false, 60 childList: true, 61 subtree: true, 62 }); 63 } 64 65 init(); 66})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.