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