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 if (this.isEnabled()) { 35 // Execute the default page-level action 36 window.grecaptcha && grecaptcha.execute(this.site_key, this.page_action); 37 } 38 }, 39 40 isEnabled: function() { 41 return !! (this.site_key && window.grecaptcha); 42 }, 43 44 /** 45 * Score an interaction to determine whether or not it's a bot. 46 * 47 * @since 4.0.7 48 * 49 * @param {string} action The name of the action being performed. 50 * 51 * @return {Promise<string>} Interaction token to be verified on server. 52 */ 53 interaction: function(action) { 54 if (! this.isEnabled()) { 55 return Promise.resolve(''); 56 } 57 58 return grecaptcha.execute(this.site_key, { action: action }); 59 } 60 } ); 61 62 window.grecaptcha && grecaptcha.ready(function() { 63 window.etCore.api.spam.recaptcha.init(); 64 }); 65 66})(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.