1/** 2 * NOTE: A minified copy of this script will be generated by grunt. Only the minified file will be included in zipped releases. 3 * 4 * @file Handles reCAPTCHA on the frontend. 5 * @since 4.0.7 6 */ 7 8 9(function($) { 10 window.etCore = window.etCore || {}; 11 window.etCore.api = window.etCore.api || {}; 12 window.etCore.api.spam = window.etCore.api.spam || {}; 13 14 /** 15 * Recaptcha 16 * 17 * @since?? 18 * 19 * @memberof window.etCore.api.spam 20 */ 21 window.etCore.api.spam.recaptcha = $.extend( et_core_api_spam_recaptcha, { 22 23 _bindMethods: function(target) { 24 Object.keys(target).forEach(function(prop) { 25 if (target.hasOwnProperty(prop) && 'function' === typeof target[prop]) { 26 target[prop] = target[prop].bind(target); 27 } 28 }); 29 }, 30 31 init: function() { 32 this._bindMethods(this); 33 34 // Execute the default page-level action 35 window.grecaptcha && grecaptcha.execute(this.site_key, this.page_action); 36 }, 37 38 isEnabled: function() { 39 return !! (this.site_key && window.grecaptcha); 40 }, 41 42 /** 43 * Score an interaction to determine whether or not it's a bot. 44 * 45 * @since 4.0.7 46 * 47 * @param {string} action The name of the action being performed. 48 * 49 * @return {Promise<string>} Interaction token to be verified on server. 50 */ 51 interaction: function(action) { 52 if (! this.site_key || ! window.grecaptcha) { 53 return Promise.resolve(''); 54 } 55 56 return grecaptcha.execute(this.site_key, { action: action }); 57 } 58 } ); 59 60 window.grecaptcha && grecaptcha.ready(function() { 61 window.etCore.api.spam.recaptcha.init(); 62 }); 63 64})(jQuery);
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.