1/* global jQuery, MUZICON_STORAGE */ 2 3( function() { 4 "use strict"; 5 6 jQuery( document ).on( 'action.ready_muzicon', function() { 7 8 jQuery(".wpcf7-form").each( function () { 9 10 var $form = jQuery( this ); 11 12 // CF7 checkboxes and radio - add class to correct check/uncheck pseudoelement when input at right side of the label 13 $form.find( '.wpcf7-checkbox > .wpcf7-list-item > .wpcf7-list-item-label,.wpcf7-radio > .wpcf7-list-item > .wpcf7-list-item-label' ) 14 .each( function() { 15 var $label = jQuery( this ); 16 if ($label.next( 'input[type="checkbox"],input[type="radio"]' ).length > 0) { 17 $label.addClass( 'wpcf7-list-item-right' ); 18 } 19 } ); 20 $form.find( '.wpcf7-checkbox > .wpcf7-list-item > .wpcf7-list-item-label,.wpcf7-radio > .wpcf7-list-item > .wpcf7-list-item-label,.wpcf7-wpgdprc > .wpcf7-list-item > .wpcf7-list-item-label' ) 21 .on( 'click', function() { 22 var $chk = jQuery( this ).siblings( 'input[type="checkbox"],input[type="radio"]' ); 23 if ( $chk.length > 0 ) { 24 if ( $chk.attr( 'type' ) == 'radio' ) { 25 jQuery( this ).parents( '.wpcf7-radio' ) 26 .find( '.wpcf7-list-item-label' ).removeClass( 'wpcf7-list-item-checked' ) 27 .find( 'input[type="radio"]' ).each( function(){ 28 this.checked = false; 29 } ); 30 } 31 $chk.get( 0 ).checked = $chk.get( 0 ).checked ? false : true; 32 jQuery( this ).toggleClass( 'wpcf7-list-item-checked', $chk.get( 0 ).checked ); 33 $chk.trigger('change'); 34 } 35 } ); 36 37 // Remove 'disabled' from submit button if acceptance checkbox is not checked
38 var $submit = $form.find( 'input:submit' ); 39 if ( $submit.length > 0 ) { 40 var submit_reset_timeout = 0; 41 // Remove on first run 42 $submit.prop( 'disabled', false ); 43 // Remove on change any field 44 $form.on( 'change', 'input,select,textarea', function() { 45 setTimeout( function() { 46 $submit.prop( 'disabled', false ).removeAttr( 'disabled' ); 47 }, submit_reset_timeout ); 48 } ); 49 // Remove after form reset (after AJAX queries also) 50 $form.get(0).addEventListener( 'wpcf7reset', function() { 51 setTimeout( function() { 52 $submit.prop( 'disabled', false ).removeAttr( 'disabled' ); 53 }, submit_reset_timeout ); 54 } ); 55 // Remove after any AJAX query 56 // Commented, because previous handler already fix a problem 57 if ( false ) { 58 jQuery( document ).on( 'ajaxComplete', function(e) { 59 setTimeout( function() { 60 $submit.prop( 'disabled', false ).removeAttr( 'disabled' ); 61 }, submit_reset_timeout ); 62 } ); 63 } 64 } 65 } ); 66 } ); 67 68} )();
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.