1jQuery.noConflict(); 2(function($) { 3 function fpf_field_value( field_name ) { 4 if ( jQuery( 'input[name=' + field_name + ']' ).length ) { 5 if ( jQuery( 'input[name=' + field_name + ']' ).attr( 'type' ) == 'radio' ) { 6 return jQuery('input[name=' + field_name + ']:checked').val();; 7 } 8 if ( jQuery( 'input[name=' + field_name + ']' ).attr( 'type' ) == 'checkbox' ) { 9 if ( jQuery('input[name=' + field_name + ']').is(':checked') ) { 10 return 'checked'; 11 } 12 else { 13 return 'unchecked'; 14 } 15 } 16 return jQuery('input[name=' + field_name + ']').val(); 17 } 18 if ( jQuery( 'select[name=' + field_name + ']' ).length ) { 19 return jQuery( 'select[name=' + field_name + ']' ).val(); 20 } 21 } 22 23 function fpf_field_change_rules() { 24 var hidden_fields = true; 25 while ( hidden_fields) { 26 hidden_fields = false; 27 jQuery.each(fpf_product.fields_rules, function (index, field) { 28 var operator = field.operator; 29 var show_field = true; 30 if (operator == 'or') { 31 show_field = false; 32 } 33 jQuery.each(field.rules, function (index_rule, value_rule) { 34 var rule_result = false;
35 if ( value_rule.field != '' ) { 36 var field_value = fpf_field_value(value_rule.field); 37 if (typeof fpf_product.fields_rules[value_rule.field] !== 'undefined') { 38 if (!fpf_product.fields_rules[value_rule.field].enabled) { 39 field_value = value_rule.field_value + '1'; 40 } 41 } 42 rule_result = (field_value == value_rule.field_value); 43 } 44 if (value_rule.compare == 'is_not') { 45 rule_result = !rule_result; 46 } 47 if (operator == 'and') { 48 show_field = show_field && rule_result; 49 } 50 if (operator == 'or') { 51 show_field = show_field || rule_result; 52 } 53 }); 54 if ( !show_field ) { 55 if ( typeof field.enabled == 'undefined' || field.enabled ) { 56 field.enabled = false; 57 hidden_fields = true; 58 jQuery('#' + index + '_field').parent().hide(); 59 } 60 } 61 else { 62 field.enabled = true; 63 jQuery('#' + index + '_field').parent().show(); 64 } 65 }); 66 } 67 } 68 jQuery(document).on('change','select.fpf-input-field,input.fpf-input-field',function(){ 69 fpf_field_change_rules(); 70 }); 71 72 jQuery(document).ready(function(){ 73 jQuery('select.fpf-input-field,input.fpf-input-field').change(); 74 }) 75 76})(jQuery); 77
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.