1/** 2* All-In-One Image CAPTCHA Pro 3* Version 8.10.13 4**/ 5 6let ai1ic_audio = ''; 7 8 9// Fectch audio file on focus 10function ai1ic_fetch_audio(e) { 11 if (e.target.matches('input[name=kc_captcha]')) { 12 let key = e.target.closest('.kc_captcha').querySelector('input[name=kc_key]').value; 13 let secret = e.target.value; 14 ai1ic_audio = new Audio(ai1ic_audio_url+key+'-'+secret); 15 } 16} 17 18 19// Play audio file when P key is released 20function ai1ic_play_audio(e) { 21 if (e.target.matches('input[name=kc_captcha]')) { 22 if (e.keyCode == 80) { 23 setTimeout(function () { 24 ai1ic_audio.play(); 25 }, 300); 26 } 27 } 28} 29 30 31// Play "correct" tone when focussed on screen reader icon and enter or spacebar pressed or icon clicked 32function ai1ic_play_correct(e) { 33 if (e.target.matches('.ai1ic_screenreader') || e.target.parentElement.matches('.ai1ic_screenreader')) { 34 e.preventDefault(); 35 correct = new Audio(ai1ic_plugin_url+'audio/correct.mp3'); 36 setTimeout(function () { 37 correct.play(); 38 }, 300); 39 } 40} 41 42 43// Reverse honeypot, empty honeypot on mouse move or key press 44function ai1ic_honeypot() { 45 document.removeEventListener('keydown', ai1ic_honeypot); // stop listening 46 document.removeEventListener('click', ai1ic_honeypot); // stop listening 47 window.removeEventListener('mousemove', ai1ic_honeypot); // stop listening 48 let reverseHoneypot = document.querySelectorAll('input[name=name-kc]'); 49 for (var i = 0; i < reverseHoneypot.length; i++) { 50 reverseHoneypot[i].setAttribute("value", ""); 51 } 52} 53 54 55// Check if CAPTCHA has toggle function 56function ai1ic_toggle(e) { 57 if (e.target.matches('input') || e.target.matches('textarea') || e.target.matches('select')) { 58 let thisForm = e.target.form; 59 let toggle = (thisForm.querySelector('.kc_captcha.toggle')) ? thisForm.querySelector('.kc_captcha.toggle') : null; 60 if(toggle != null) { 61 toggle.style.display = 'block'; 62 } 63 } 64} 65 66 67 68// Re-add event listeners when CAPTCHA changes with ajax 69let ai1ic_target = document.querySelector('body'); // get all Image CAPTCHAs 70let ai1ic_observer = new MutationObserver(function(mutations) { 71 mutations.forEach(function(mutation) { 72 document.addEventListener('keydown', ai1ic_honeypot); 73 document.addEventListener('click', ai1ic_honeypot); 74 window.addEventListener('mousemove', ai1ic_honeypot); 75 }); 76}); 77ai1ic_observer.observe(ai1ic_target, { childList: true, subtree: true }); 78 79 80 81document.addEventListener('DOMContentLoaded', function() { 82 document.addEventListener('focusin', ai1ic_fetch_audio, true); 83 document.addEventListener('keyup', ai1ic_play_audio); 84 document.addEventListener('click', ai1ic_play_correct); 85 document.addEventListener('keypress', ai1ic_toggle); 86 document.addEventListener('click', ai1ic_toggle); 87}) 88 89 90 91// Ajax scripts 92let ajax_class = document.getElementsByClassName('cf7ic-loader'); 93if (ajax_class.length > 0) { 94 95 //ES5 - Load Image CAPTCHA 96 document.addEventListener("DOMContentLoaded", function () { 97 let cf7ic = document.querySelectorAll(".cf7ic-loader"); 98 observer = new IntersectionObserver(function (entries) { 99 entries.forEach(function (entry) { 100 if (entry.intersectionRatio > 0) { 101 102 /* FETCH */ 103 const data = new FormData(); 104 105 data.append( 'action', 'cf7ic_generate' ); 106 data.append( 'toggle', entry.target.dataset.toggle ); 107 data.append( 'generate', 'generate_full' ); 108 data.append( 'lang', document.documentElement.lang.substring(0,2) ); 109 110 fetch(cf7ic_ajax_url, {method: 'POST', credentials: 'same-origin', body: data }) 111 .then((data) => data.text()) 112 .then((data) => { 113 let captcha = document.querySelector("#"+entry.target.id); 114 if(captcha) { captcha.outerHTML = data } 115 //document.querySelector("#"+entry.target.id).outerHTML = data; 116 document.addEventListener('keypress', ai1ic_toggle); 117 document.addEventListener('click', ai1ic_toggle); 118 }) 119 .catch((error) => { console.log(error); }); 120 121 observer.unobserve(entry.target); 122 } 123 }); 124 }); 125 Array.prototype.forEach.call (cf7ic, function (node) { 126 observer.observe(node); 127 }); 128 });
129 130 // Load inner CAPTCHA 131 Array.prototype.forEach.call(document.querySelectorAll('form'), function (el) { 132 if(el.id) { // If not CF7 form 133 el.addEventListener('submit', function () { 134 ai1ic_load_inner('#'+el.id); 135 }); 136 } else { // Else is a CF7 form 137 el.addEventListener('wpcf7submit', function () { 138 ai1ic_load_inner(event.detail.apiResponse.into); 139 }); 140 } 141 142 function ai1ic_load_inner(id) { 143 let kc_target = id+" .captcha-image"; 144 145 /* FETCH */ 146 const data = new FormData(); 147 148 data.append( 'action', 'cf7ic_generate' ); 149 data.append( 'toggle', 'no-toggle' ); 150 data.append( 'generate', 'regenerate_inner' ); 151 data.append( 'lang', document.documentElement.lang.substring(0,2) ); 152 153 fetch(cf7ic_ajax_url, {method: 'POST', credentials: 'same-origin', body: data }) 154 .then((data) => data.text()) 155 .then((data) => { 156 document.querySelector(kc_target).outerHTML = data; 157 }) 158 .catch((error) => { console.log(error); }); 159 }; 160 }, false ); 161 162 163 /** 164 * Copyright 2016 Google Inc. All Rights Reserved. 165 * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE. 166 * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document 167 */ 168 !function(f,_){"use strict";if("IntersectionObserver"in f&&"IntersectionObserverEntry"in f&&"intersectionRatio"in f.IntersectionObserverEntry.prototype)"isIntersecting"in f.IntersectionObserverEntry.prototype||Object.defineProperty(f.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return 0<this.intersectionRatio}});else{var e=[];t.prototype.THROTTLE_TIMEOUT=100,t.prototype.POLL_INTERVAL=null,t.prototype.USE_MUTATION_OBSERVER=!0,t.prototype.observe=function(e){if(!this._observationTargets.some(function(t){return t.element==e})){if(!e||1!=e.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:e,entry:null}),this._monitorIntersections(),this._checkForIntersections()}},t.prototype.unobserve=function(e){this._observationTargets=this._observationTargets.filter(function(t){return t.element!=e}),this._observationTargets.length||(this._unmonitorIntersections(),this._unregisterInstance())},t.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorIntersections(),this._unregisterInstance()},t.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},t.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(t,e,n){if("number"!=typeof t||isNaN(t)||t<0||1<t)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==n[e-1]})},t.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map(function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}});return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},t.prototype._monitorIntersections=function(){this._monitoringIntersections||(this._monitoringIntersections=!0,this.POLL_INTERVAL?this._monitoringInterval=setInterval(this._checkForIntersections,this.POLL_INTERVAL):(n(f,"resize",this._checkForIntersections,!0),n(_,"scroll",this._checkForIntersections,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in f&&(this._domObserver=new MutationObserver(this._checkForIntersections),this._domObserver.observe(_,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))))},t.prototype._unmonitorIntersections=function(){this._monitoringIntersections&&(this._monitoringIntersections=!1,clearInterval(this._monitoringInterval),this._monitoringInterval=null,o(f,"resize",this._checkForIntersections,!0),o(_,"scroll",this._checkForIntersections,!0),this._domObserver&&(this._domObserver.disconnect(),this._domObserver=null))},t.prototype._checkForIntersections=function(){var h=this._rootIsInDom(),c=h?this._getRootRect():{top:0,bottom:0,left:0,right:0,width:0,height:0};
168this._observationTargets.forEach(function(t){var e=t.element,n=m(e),o=this._rootContainsTarget(e),i=t.entry,r=h&&o&&this._computeTargetAndRootIntersection(e,c),s=t.entry=new a({time:f.performance&&performance.now&&performance.now(),target:e,boundingClientRect:n,rootBounds:c,intersectionRect:r});i?h&&o?this._hasCrossedThreshold(i,s)&&this._queuedEntries.push(s):i&&i.isIntersecting&&this._queuedEntries.push(s):this._queuedEntries.push(s)},this),this._queuedEntries.length&&this._callback(this.takeRecords(),this)},t.prototype._computeTargetAndRootIntersection=function(t,e){if("none"!=f.getComputedStyle(t).display){for(var n,o,i,r,s,h,c,a,u=m(t),l=v(t),p=!1;!p;){var d=null,g=1==l.nodeType?f.getComputedStyle(l):{};if("none"==g.display)return;if(l==this.root||l==_?(p=!0,d=e):l!=_.body&&l!=_.documentElement&&"visible"!=g.overflow&&(d=m(l)),d&&(n=d,o=u,void 0,i=Math.max(n.top,o.top),r=Math.min(n.bottom,o.bottom),s=Math.max(n.left,o.left),h=Math.min(n.right,o.right),a=r-i,!(u=0<=(c=h-s)&&0<=a&&{top:i,bottom:r,left:s,right:h,width:c,height:a})))break;l=v(l)}return u}},t.prototype._getRootRect=function(){var t;if(this.root)t=m(this.root);else{var e=_.documentElement,n=_.body;t={top:0,left:0,right:e.clientWidth||n.clientWidth,width:e.clientWidth||n.clientWidth,bottom:e.clientHeight||n.clientHeight,height:e.clientHeight||n.clientHeight}}return this._expandRectByRootMargin(t)},t.prototype._expandRectByRootMargin=function(n){var t=this._rootMarginValues.map(function(t,e){return"px"==t.unit?t.value:t.value*(e%2?n.width:n.height)/100}),e={top:n.top-t[0],right:n.right+t[1],bottom:n.bottom+t[2],left:n.left-t[3]};return e.width=e.right-e.left,e.height=e.bottom-e.top,e},t.prototype._hasCrossedThreshold=function(t,e){var n=t&&t.isIntersecting?t.intersectionRatio||0:-1,o=e.isIntersecting?e.intersectionRatio||0:-1;if(n!==o)for(var i=0;i<this.thresholds.length;i++){var r=this.thresholds[i];if(r==n||r==o||r<n!=r<o)return!0}},t.prototype._rootIsInDom=function(){return!this.root||i(_,this.root)},t.prototype._rootContainsTarget=function(t){return i(this.root||_,t)},t.prototype._registerInstance=function(){e.indexOf(this)<0&&e.push(this)},t.prototype._unregisterInstance=function(){var t=e.indexOf(this);-1!=t&&e.splice(t,1)},f.IntersectionObserver=t,f.IntersectionObserverEntry=a}function a(t){this.time=t.time,this.target=t.target,this.rootBounds=t.rootBounds,this.boundingClientRect=t.boundingClientRect,this.intersectionRect=t.intersectionRect||{top:0,bottom:0,left:0,right:0,width:0,height:0},this.isIntersecting=!!t.intersectionRect;var e=this.boundingClientRect,n=e.width*e.height,o=this.intersectionRect,i=o.width*o.height;this.intersectionRatio=n?Number((i/n).toFixed(4)):this.isIntersecting?1:0}function t(t,e){var n,o,i,r=e||{};if("function"!=typeof t)throw new Error("callback must be a function");if(r.root&&1!=r.root.nodeType)throw new Error("root must be an Element");this._checkForIntersections=(n=this._checkForIntersections.bind(this),o=this.THROTTLE_TIMEOUT,i=null,function(){i||(i=setTimeout(function(){n(),i=null},o))}),this._callback=t,this._observationTargets=[],this._queuedEntries=[],this._rootMarginValues=this._parseRootMargin(r.rootMargin),this.thresholds=this._initThresholds(r.threshold),this.root=r.root||null,this.rootMargin=this._rootMarginValues.map(function(t){return t.value+t.unit}).join(" ")}function n(t,e,n,o){"function"==typeof t.addEventListener?t.addEventListener(e,n,o||!1):"function"==typeof t.attachEvent&&t.attachEvent("on"+e,n)}function o(t,e,n,o){"function"==typeof t.removeEventListener?t.removeEventListener(e,n,o||!1):"function"==typeof t.detatchEvent&&t.detatchEvent("on"+e,n)}function m(t){var e;try{e=t.getBoundingClientRect()}catch(t){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):{top:0,bottom:0,left:0,right:0,width:0,height:0}}function i(t,e){for(var n=e;n;){if(n==t)return!0;n=v(n)}return!1}function v(t){var e=t.parentNode;return e&&11==e.nodeType&&e.host?e.host:e&&e.assignedSlot?e.assignedSlot.parentNode:e}}(window,document); 169 170} // End of if axaj_class exists
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.