Server IP : 66.29.132.124 / Your IP : 18.119.133.214 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/cwd/js/ |
Upload File : |
jQuery(function($){ $(document).ready(function () { var condition_object='select, input[type="radio"]:checked, input[type="text"], input[type="hidden"], input.ot-numeric-slider-hidden-input,input[type="checkbox"]'; // condition function to show and hide sections $('.bravo_wrap').on( 'change.conditionals', condition_object, function(e) { run_condition_engine(); }); run_condition_engine(); function run_condition_engine(){ $('[data-condition]').each(function() { var passed; var conditions = get_match_condition( $( this ).data( 'condition' ) ); var operator = ( $( this ).data( 'operator' ) || 'and' ).toLowerCase(); $.each( conditions, function( index, condition ) { var target = $( '[name='+ condition.check+']' ); var targetEl = !! target.length && target.first(); if ( ! target.length || ( ! targetEl.length && condition.value.toString() != '' ) ) { return; } var v1 = targetEl.length ? targetEl.val().toString() : ''; var v2 = condition.value.toString(); var result; if(targetEl.length && targetEl.attr('type')=='radio'){ v1 = $( '[name='+ condition.check+']:checked').val(); } if(targetEl.length && targetEl.attr('type')=='checkbox'){ v1=targetEl.is(':checked')?v1:''; } switch ( condition.rule ) { case 'less_than': result = ( parseInt( v1 ) < parseInt( v2 ) ); break; case 'less_than_or_equal_to': result = ( parseInt( v1 ) <= parseInt( v2 ) ); break; case 'greater_than': result = ( parseInt( v1 ) > parseInt( v2 ) ); break; case 'greater_than_or_equal_to': result = ( parseInt( v1 ) >= parseInt( v2 ) ); break; case 'contains': result = ( v1.indexOf(v2) !== -1 ? true : false ); break; case 'is': result = ( v1 == v2 ); break; case 'not': result = ( v1 != v2 ); break; } if ( 'undefined' == typeof passed ) { passed = result; } switch ( operator ) { case 'or': passed = ( passed || result ); break; case 'and': default: passed = ( passed && result ); break; } }); if ( passed ) { $(this).show(); } else { $(this).hide(); } passed = undefined; }); } function get_match_condition(condition){ var match; var regex = /(.+?):(is|not|contains|less_than|less_than_or_equal_to|greater_than|greater_than_or_equal_to)\((.*?)\),?/g; var conditions = []; while( match = regex.exec( condition ) ) { conditions.push({ 'check': match[1], 'rule': match[2], 'value': match[3] || '' }); } return conditions; } // Please do not edit condition section if you don't understand what it is }); });