1/* global jQuery */ 2 3(function() { 4 "use strict"; 5 6 jQuery(document).on( 'action.init_hidden_elements', trx_addons_cf7_init ); 7 8 function trx_addons_cf7_init(e, container) { 9 if (container === undefined) container = jQuery('body'); 10 if (container.length === undefined || container.length === 0) return; 11 12 container.find('.wpcf7:not(.alert_inited)').each( function() { 13 var $form = jQuery(this); 14 // Decorate messages 15 $form 16 .addClass('alert_inited') 17 .on('wpcf7:submit wpcf7submit', function(e, details) { 18 var response = $form.find('.wpcf7-response-output'); 19 if ( response.length ) { 20 response 21 .addClass('trx_addons_message_box') 22 .removeClass('trx_addons_message_box_info trx_addons_message_box_error trx_addons_message_box_success'); 23 if ( typeof e == 'object' && typeof e.detail == 'object' && typeof e.detail.status != 'undefined' ) { 24 if ( e.detail.status == 'validation_failed' ) { 25 response.addClass('trx_addons_message_box_error'); 26 } else if ( e.detail.status == 'mail_sent' ) { 27 response.addClass('trx_addons_message_box_success'); 28 } else { 29 response.addClass('trx_addons_message_box_info'); 30 } 31 } 32 response.fadeIn(); 33 } 34 }) 35 .on('click keypress change', function() { 36 $form.find('.wpcf7-response-output:visible').fadeOut(); 37 } ); 38 // Remove validation tip and class on any key pressed in the field 39 $form 40 .on('change', 'input,select,textarea', function() { 41 var $self = jQuery(this), 42 $wrap = $self.parents('.wpcf7-not-valid'); 43 if ( $self.val() !== '' ) { 44 if ( $self.hasClass( 'wpcf7-not-valid' ) ) { 45 $self.removeClass('wpcf7-not-valid'); 46 } else if ( $wrap.length > 0 ) { 47 $wrap.removeClass('wpcf7-not-valid'); 48 } 49 } 50 }); 51 } ); 52 } 53 54})();
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.